E - The type of element managed by this collection.public abstract class OrderedCollection<E> extends OpenCollection<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.
|
craterdog.core.Iterator<E> |
createIterator() |
java.util.Comparator<? super E> |
getComparator()
This method returns the comparator that is used to order the elements in this collection.
|
E |
getElement(int index)
This method returns the element at the specified index.
|
OrderedCollection<E> |
getElements(int firstIndex,
int lastIndex)
This method returns a collection of the elements in the specified index range.
|
int |
getIndex(E element)
This method return the index of the specified element, or zero if the element
is not found.
|
int |
getSize() |
void |
removeAll()
This method removes all elements from the collection.
|
boolean |
removeElement(E element)
This method removes the specified element from the collection.
|
addElements, addElements, removeElements, removeElementscontainsAll, containsAny, containsElement, normalizedIndexcompareTo, equals, hashCode, toArrayaddSerializableClass, addSerializableClass, addSerializableClass, copy, createMapper, fromString, fromString, toExposedString, toString, toString, 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 craterdog.core.Iterator<E> createIterator()
public int getSize()
public E getElement(int index)
CollectiongetElement in class Collection<E>index - The index of the element to be returned.public int getIndex(E element)
CollectiongetIndex in class Collection<E>element - The element to be checked for in the collection.public OrderedCollection<E> getElements(int firstIndex, int lastIndex)
CollectiongetElements in class Collection<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)
OpenCollectionaddElement in class OpenCollection<E>element - The new element to be added.public boolean removeElement(E element)
OpenCollectionremoveElement in class OpenCollection<E>element - The element to be removed.public void removeAll()
CollectionremoveAll in class Collection<E>public java.util.Comparator<? super E> getComparator()
Copyright © 2016 Crater Dog Technologies(TM). All rights reserved.