org.apache.pivot.collections
Interface Collection<T>

All Superinterfaces:
Iterable<T>
All Known Subinterfaces:
List<T>, Map<K,V>, Queue<T>, Set<E>, Stack<T>
All Known Implementing Classes:
ArrayList, ArrayQueue, ArrayStack, BeanAdapter, Element, EnumList, EnumMap, EnumSet, FileList, HashMap, HashSet, ImmutableList, ImmutableMap, ImmutableSet, LinkedList, LinkedQueue, LinkedStack, ListAdapter, MapAdapter, ResultList, SetAdapter, SynchronizedList, SynchronizedMap, SynchronizedQueue, SynchronizedSet, SynchronizedStack

public interface Collection<T>
extends Iterable<T>

Root interface in collection hierarchy. Defines operations common to all collections.


Method Summary
 void clear()
          Removes all elements from the collection.
 Comparator<T> getComparator()
          Returns the collection's sort order.
 boolean isEmpty()
          Tests the emptiness of the collection.
 void setComparator(Comparator<T> comparator)
          Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

clear

void clear()
Removes all elements from the collection.


isEmpty

boolean isEmpty()
Tests the emptiness of the collection.

Returns:
true if the collection contains no elements; false, otherwise.

getComparator

Comparator<T> getComparator()
Returns the collection's sort order.

Returns:
The comparator used to order elements in the collection, or null if the sort order is undefined.
See Also:
setComparator(Comparator)

setComparator

void setComparator(Comparator<T> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.

Calling this method more than once with the same comparator will re-sort the collection.

Parameters:
comparator - The comparator used to order elements in the collection, or null if the collection is unsorted.