basic methods for Lists

 

  Here are the methods you can use for ArrayList, LinkedList, and Vector.  The rows show where various methods are defined - and thus where to find them in the Sun Java API.

 

 

ArrayList

LinkedList

Vector

Stack

find these in the

Collection

interface

.add(...),  .addAll(...),  .clear( ),  .contains(...),  .containsAll(...),  .isEmpty( ),  .iterator( ),  .remove(...),

 .removeAll(...),  .retainAll(...),  .size( ),  .toArray( ),  .toArray(...)

find these in  List

interface

.add(index..),  .addAll(index..),  .get(...),  .indexOf(...),  .lastIndexOf(...),   .listIterator(...),  .remove(...), .set(...),  .subList(...)

find these in the

specific

class itself

.ensureCapacity(...),

trimToSize( )

 

.addFirst(...), 

.addLast(...), 

.getFirst(...), 

.getLast(...), 

.removeFirst(...),  .removeLast(...)

 

.addElement(...), .capacity(),

.copyInto(...), .elementAt( ),

.elements( ), ensureCapacity(...), .firstElement(...), .indexOf (..index), .insertElementAt(...), .lastElement(), lastIndexOf(...),

.remove-AllElements( ),

.remove-Element( ..),

.remove-ElementAt(...),

.trimToSize( )

.empty( ),

.peek( ), .pop( ),

.push(...),

.search(...)