Find the sub-list from the list and the sub-list from the list
The usage of the member function is very strange. An element is used to search in the list. If it is found, the elements found and all elements are converted into a new list and returned. If it cannot be found, nil is returned.
(set 'aList '(a b c d e f g h)) → (a b c d e f g h)(member 'd aList) → (d e f g h)(member 55 aList) → nil
How to find the location of a specified element from the LIST in java
List <Object> list = new ArrayList <Object> ();
......
Object oldObj =...
Object newObj =...
Int index = list. indexOf (oldObj );
If (index! =-1 ){
List. add (index, newObj );
List. remove (index + 1 );
}
......
If there is a problem with the above operations, your class may need to implement the Comparable Interface
What is the search function in STL list? How can I use it?
Use the General STL algorithm find () to search for objects in the list.
List <char >:: iterator FindIterator;
FindIterator = find (cList. begin (), cList. end (), 'C ');
If (FindIterator = cList. end ())
{
Printf ("not find the char 'C '! ");
}
Else
{
Printf ("% c", * FindIterator );
}
Note: If the specified object is not found, the value of cList. end () is returned. If it is found, a pointer to the iterator object is returned.