Package org.apache.pivot.collections
Interface Set<E>
-
- All Superinterfaces:
Collection<E>,Group<E>,java.lang.Iterable<E>
- All Known Implementing Classes:
EnumSet,HashSet,ImmutableSet,SetAdapter,SynchronizedSet
public interface Set<E> extends Group<E>, Collection<E>
Collection interface representing a group of unique elements.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanadd(E element)Adds an element to the group.voidclear()Removes all elements from the collection.intgetCount()ListenerList<SetListener<E>>getSetListeners()booleanremove(E element)Removes an element from the group.voidsetComparator(java.util.Comparator<E> 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 org.apache.pivot.collections.Collection
getComparator, isEmpty
-
-
-
-
Method Detail
-
add
boolean add(E element)
Description copied from interface:GroupAdds an element to the group.- Specified by:
addin interfaceGroup<E>- Parameters:
element- The element to add to the group.- Returns:
trueif the element was added to the group;false, otherwise.- See Also:
SetListener.elementAdded(Set, Object)
-
remove
boolean remove(E element)
Description copied from interface:GroupRemoves an element from the group.- Specified by:
removein interfaceGroup<E>- Parameters:
element- The element to remove from the set.- Returns:
trueif the element was removed from the group;false, otherwise.- See Also:
SetListener.elementRemoved(Set, Object)
-
clear
void clear()
Description copied from interface:CollectionRemoves all elements from the collection.- Specified by:
clearin interfaceCollection<E>- See Also:
SetListener.setCleared(Set)
-
getCount
int getCount()
- Returns:
- The number of elements in the set.
-
setComparator
void setComparator(java.util.Comparator<E> comparator)
Description copied from interface:CollectionSets 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.
- Specified by:
setComparatorin interfaceCollection<E>- Parameters:
comparator- The comparator used to order elements in the collection, or null if the collection is unsorted.- See Also:
SetListener.setCleared(Set)
-
getSetListeners
ListenerList<SetListener<E>> getSetListeners()
- Returns:
- The set listener list.
-
-