mentationsassertions are used to enforce such preconditions in commercial implementationsuch violations would be best implemented by the java exception mechanism list can be iterated through as shown in the following code fragment for ( movetostart() currpos()< length() next()it getvalue()dosomething(it)in this exampleeach element of the list in turn is stored in itand passed to the dosomething function the loop terminates when the current position reaches the end of the list the list class declaration presented here is just one of many possible interpretations for lists figure provides most of the operations that one naturally expects to perform on lists and serves to illustrate the issues relevant to implementing the list data structure as an example of using the list adtwe can create function to return true if there is an occurrence of given integer in the listand false otherwise the find method needs no knowledge about the specific list implementationjust the list adt /*@return true if "kis in list " "false otherwise *public static boolean find(list lint kint itfor ( movetostart() currpos()< length() next()it getvalue()if ( =itreturn true/found return false/ not found while this implementation for find could be written as generic with respect to the element typeit would still be limited in its ability to handle different data types stored on the list in particularit only works when the description for the object being searched for ( in the functionis of the same type as the objects themselves more typical situation is that we are searching for record that contains key field who' value matches similar functions to find and return composite element based on key value can be created using the list implementationbut to do so requires some agreement between the list adt and the find function on the concept of keyand on how keys may be compared this topic will be discussed in section