E - The type of element managed by this collection.public abstract class OrderedCollection<E> extends OpenCollection<E> implements Ordered<E>
Comparator. If no comparator is specified, the
elements extend the Comparable interface.| Modifier | Constructor and Description |
|---|---|
protected |
OrderedCollection(boolean duplicatesAllowed)
This constructor creates a new empty collection with no comparator function.
|
protected |
OrderedCollection(boolean duplicatesAllowed,
java.util.Comparator<? super E> comparator)
This constructor creates a new collection with the specified comparator function.
|
protected |
OrderedCollection(E[] elements,
boolean duplicatesAllowed)
This constructor creates a new collection with no comparator function and seeds
it with the elements from the specified array.
|
protected |
OrderedCollection(E[] elements,
boolean duplicatesAllowed,
java.util.Comparator<? super E> comparator)
This constructor creates a new collection with the specified comparator function and seeds
it with the elements from the specified array.
|
protected |
OrderedCollection(java.lang.Iterable<? extends E> elements,
boolean duplicatesAllowed)
This constructor creates a new collection with no comparator function and seeds
it with the elements from the specified collection.
|
protected |
OrderedCollection(java.lang.Iterable<? extends E> elements,
boolean duplicatesAllowed,
java.util.Comparator<? super E> comparator)
This constructor creates a new collection with the specified comparator function and seeds
it with the elements from the specified collection.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addElement(E element)
This method adds a new element to the collection.
|
Iterator<E> |
createDefaultIterator()
This method creates a new default iterator for the collection.
|
java.util.Comparator<? super E> |
getComparator()
This method returns the comparator that is used to order the elements in this collection.
|
E |
getElementAtIndex(int index)
This method returns the element at the specified index.
|
OrderedCollection<E> |
getElementsInRange(int firstIndex,
int lastIndex)
This method returns a collection of the elements in the specified index range.
|
int |
getIndexOfElement(E element)
This method return the index of the specified element, or zero if the element
is not found.
|
int |
getNumberOfElements() |
void |
removeAllElements()
This method removes all elements from the collection.
|
boolean |
removeElement(E element)
This method removes the specified element from the collection.
|
addElements, addElements, removeElements, removeElementscompareTo, containsAllElementsIn, containsAnyElementsIn, containsElement, equals, hashCode, isEmpty, iterator, normalizedIndex, toArrayaddSerializableClass, addSerializableClass, copy, toExposedString, toString, toStringprotected OrderedCollection(boolean duplicatesAllowed)
duplicatesAllowed - Whether or not duplicate elements are allowed.protected OrderedCollection(E[] elements, boolean duplicatesAllowed)
elements - The elements to be used to seed the new collection.duplicatesAllowed - Whether or not duplicate elements are allowed.protected OrderedCollection(java.lang.Iterable<? extends E> elements, boolean duplicatesAllowed)
elements - The elements to be used to seed the new collection.duplicatesAllowed - Whether or not duplicate elements are allowed.protected OrderedCollection(boolean duplicatesAllowed,
java.util.Comparator<? super E> comparator)
duplicatesAllowed - Whether or not duplicate elements are allowed.comparator - The comparator to be used to compare two elements during ordering.protected OrderedCollection(E[] elements, boolean duplicatesAllowed, java.util.Comparator<? super E> comparator)
elements - The elements to be used to seed the new collection.duplicatesAllowed - Whether or not duplicate elements are allowed.comparator - The comparator to be used to compare two elements during ordering.protected OrderedCollection(java.lang.Iterable<? extends E> elements, boolean duplicatesAllowed, java.util.Comparator<? super E> comparator)
elements - The elements to be used to seed the new collection.duplicatesAllowed - Whether or not duplicate elements are allowed.comparator - The comparator to be used to compare two elements during ordering.public Iterator<E> createDefaultIterator()
AccessiblecreateDefaultIterator in interface Accessible<E>public int getNumberOfElements()
getNumberOfElements in interface Sequential<E>public E getElementAtIndex(int index)
AccessiblegetElementAtIndex in interface Accessible<E>index - The index of the element to be returned.public int getIndexOfElement(E element)
AccessiblegetIndexOfElement in interface Accessible<E>element - The element to be checked for in the collection.public OrderedCollection<E> getElementsInRange(int firstIndex, int lastIndex)
AccessiblegetElementsInRange in interface Accessible<E>firstIndex - The index of the first element to be returned.lastIndex - the index of the last element to be returned.public boolean addElement(E element)
DynamicaddElement in interface Dynamic<E>element - The new element to be added.public boolean removeElement(E element)
DynamicremoveElement in interface Dynamic<E>element - The element to be removed.public void removeAllElements()
AccessibleremoveAllElements in interface Accessible<E>public java.util.Comparator<? super E> getComparator()
OrderedgetComparator in interface Ordered<E>Copyright © 2015 Crater Dog Technologies(TM). All rights reserved.