Package org.apache.pivot.collections
Interface Collection<T>
-
- All Superinterfaces:
java.lang.Iterable<T>
- All Known Implementing Classes:
ArrayList
,ArrayQueue
,ArrayStack
,BeanAdapter
,CalendarDateSpinnerData
,CategorySeries
,Element
,EnumList
,EnumMap
,EnumSet
,FileList
,FileObjectList
,HashMap
,HashSet
,HistogramSeries
,ImmutableList
,ImmutableMap
,ImmutableSet
,LinkedList
,LinkedQueue
,LinkedStack
,ListAdapter
,MapAdapter
,NumericSpinnerData
,ResultList
,SetAdapter
,SynchronizedList
,SynchronizedMap
,SynchronizedQueue
,SynchronizedSet
,SynchronizedStack
,TreeBranch
,ValueSeries
public interface Collection<T> extends java.lang.Iterable<T>
Root interface in collection hierarchy. Defines operations common to all collections.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear()
Removes all elements from the collection.java.util.Comparator<T>
getComparator()
Returns the collection's sort order.boolean
isEmpty()
Tests the emptiness of the collection.void
setComparator(java.util.Comparator<T> comparator)
Sets the collection's sort order, re-ordering the collection's contents and ensuring that new entries preserve the sort order.
-
-
-
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
java.util.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(java.util.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.
-
-