Finding collection methods

 

  Here are all the methods you can use for ArrayList, LinkedList, Vector and Stack.  The rows show where various methods are defined - meaning 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(...),

.removeAllElements( ),

.remove-Element( ..), .removeElementAt(...),

.trimToSize( )

.empty( ),

.peek( ), .pop( ),

.push(...),

.search(...)

 

  Here are all the methods you can use for Sets, and where to find them in the API.

 

 

HashSet

TreeSet

find these in the

Collection

interface

.add(...),  .addAll(...),  .clear( ),  .contains(...),  .containsAll(...),  .isEmpty( ),  .iterator( ),  .remove(...),  .removeAll(...),  .retainAll(...),  .size( ),  .toArray( ),  .toArray(...)

look in the

class itself

- -

.first( ),  .headSet(...), .last( ), 

.subSet(...),  .tailSet(...)

 

  Here are all the methods you can use for Maps, and where to find them in the API.

 

 

HashMap

TreeMap

find these in the

Map

interface

.clear( ), .containsKey(...), .containsValue(...), .entrySet( ), .get(...), .isEmpty( ),

.keySet( ), .put(...), .putAll(...), .remove(...), .size( ), .values( )

look in the

class itself

- -

..firstKey( ), .headMap(...), .lastKey( ),

.subMap(...), .tailMap(...)