parser/src/LinkedListAPI.c
void* findElement(List * list, bool (*customCompare)(const void* first,const void* second), const void* searchRecord){
	if (customCompare == NULL)
		return NULL;

	ListIterator itr = createIterator(list);

	void* data = nextElement(&itr);
	while (data != NULL)
	{
		if (customCompare(data, searchRecord))
			return data;

		data = nextElement(&itr);
	}

	return NULL;
}
/** Function that searches for an element in the list using a comparator function.
 * If an element is found, a pointer to the data of that element is returned
 * Returns NULL if the element is not found.
 *@pre List exists and is valid.  Comparator function has been provided.
 *@post List remains unchanged.
 *@return The data associated with the list element that matches the search criteria.  If element is not found, return NULL.
 *@param list - a pointer to the List sruct
 *@param customCompare - a pointer to comparator function for customizing the search
 *@param searchRecord - a pointer to search data, which contains seach criteria
 *Note: while the arguments of compare() and searchRecord are all void, it is assumed that records they point to are
 *      all of the same type - just like arguments to the compare() function in the List struct
 **/
Function that searches for an element in the list using a comparator function.
If an element is found, a pointer to the data of that element is returned
Returns NULL if the element is not found.
@pre List exists and is valid.  Comparator function has been provided.
@post List remains unchanged.
@return The data associated with the list element that matches the search criteria.  If element is not found, return NULL.
@param list - a pointer to the List sruct
@param customCompare - a pointer to comparator function for customizing the search
@param searchRecord - a pointer to search data, which contains seach criteria
Note: while the arguments of compare() and searchRecord are all void, it is assumed that records they point to are
all of the same type - just like arguments to the compare() function in the List struct
Function that searches for an element in the list using a comparator function . If an element is found a pointer to the data of that element is returned Returns NULL if the element is not found . @pre List exists and is valid . Comparator function has been provided . @post List remains unchanged . @return The data associated with the list element that matches the search criteria . If element is not found return NULL . @param list - a pointer to the List sruct @param customCompare - a pointer to comparator function for customizing the search @param searchRecord - a pointer to search data which contains seach criteria Note : while the arguments of compare () and searchRecord are all void it is assumed that records they point to are all of the same type - just like arguments to the compare () function in the List struct
void* findElement(List * list, bool (*customCompare)(const void* first,const void* second), const void* searchRecord){
	if (customCompare == NULL)
		return NULL;
	ListIterator itr = createIterator(list);
	void* data = nextElement(&itr);
	while (data != NULL)
	{
		if (customCompare(data, searchRecord))
			return data;
		data = nextElement(&itr);
	}
	return NULL;
}
void * findElement ( List * list , bool ( * customCompare ) ( const void * first , const void * second ) , const void * searchRecord ) { if ( customCompare == NULL ) return NULL ; ListIterator itr = createIterator ( list ) ; void * data = nextElement ( & itr ) ; while ( data != NULL ) { if ( customCompare ( data , searchRecord ) ) return data ; data = nextElement ( & itr ) ; } return NULL ; }
Function that searches for an element in the list using a comparator function.
Function that searches for an element in the list using a comparator function .