|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.omnaest.utils.structure.collection.CollectionAbstract<E>
org.omnaest.utils.structure.collection.list.ListAbstract<E>
org.omnaest.utils.structure.collection.list.sorted.SortedListAbstract<E>
E - public abstract class SortedListAbstract<E>
Abstract implementation of a SortedList which reduces the need to implement all methods
| Nested Class Summary | |
|---|---|
protected static class |
SortedListAbstract.SortedListAbstractSublist<E>
Sublist implementation for SortedListAbstract |
| Nested classes/interfaces inherited from class org.omnaest.utils.structure.collection.list.ListAbstract |
|---|
ListAbstract.ListAbstractSublist<E> |
| Field Summary | |
|---|---|
protected Comparator<E> |
comparator
The constructor will ensure that the Comparator will not be null |
| Constructor Summary | |
|---|---|
SortedListAbstract()
Using this constructor enforces that all element types implement the Comparable interface |
|
SortedListAbstract(Comparator<E> comparator)
|
|
| Method Summary | ||
|---|---|---|
void |
add(int index,
E element)
The SortedList.add(int, Object) ignores the given index position and acts similar to the SortedList.add(Object) method |
|
Comparator<? super E> |
comparator()
Returns the Comparator used by this SortedList |
|
E |
first()
Returns the first (lowest) element currently in this SortedList. |
|
protected static
|
first(SortedList<E> sortedList)
|
|
E |
getFirst()
|
|
E |
getLast()
|
|
SortedList<E> |
headList(E toElement)
Returns a view to the current SortedList which starts at the beginning and ends by the given element which itself is
excluded from the head list. |
|
protected static
|
headList(SortedList<E> list,
E toElement)
|
|
E |
last()
Returns the last (highest) element currently in this SortedList. |
|
protected static
|
last(SortedList<E> sortedList)
|
|
protected SortedList<E> |
newInstance(Collection<E> collection)
Creates a new SortedList instance |
|
E |
set(int index,
E element)
Uses List.remove(int) to remove the element from the given index position an returns it. |
|
SortedList<E> |
splitAt(int index)
Splits the current SortedList at the given index position. |
|
SortedList<E> |
subList(E fromElement,
E toElement)
Returns a sublist view of the current SortedList starting by the given fromElement which will be included in
the sublist and ending by the given toElement which will be excluded from the sublist. |
|
SortedList<E> |
subList(int fromIndex,
int toIndex)
Similar to List#subList(int, int) |
|
protected static
|
subList(SortedList<E> list,
E fromElement,
E toElement)
|
|
SortedList<E> |
tailList(E fromElement)
Returns a view to the current SortedList starting by the given element up to the end including the given element. |
|
protected static
|
tailList(SortedList<E> list,
E fromElement)
|
|
| Methods inherited from class org.omnaest.utils.structure.collection.list.ListAbstract |
|---|
addAll, addFirst, addLast, clear, contains, descendingIterator, element, isValidIndex, iterator, listIterator, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence |
| Methods inherited from class org.omnaest.utils.structure.collection.CollectionAbstract |
|---|
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.omnaest.utils.structure.collection.list.sorted.SortedList |
|---|
add |
| Methods inherited from interface java.util.List |
|---|
addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface java.util.Deque |
|---|
add, size |
| Field Detail |
|---|
protected final Comparator<E> comparator
Comparator will not be null
| Constructor Detail |
|---|
public SortedListAbstract(Comparator<E> comparator)
comparator - SortedListAbstractpublic SortedListAbstract()
Comparable interface
SortedListAbstract| Method Detail |
|---|
public Comparator<? super E> comparator()
SortedListComparator used by this SortedList
comparator in interface SortedList<E>public E first()
SortedListSortedList.
first in interface SortedList<E>protected static <E> E first(SortedList<E> sortedList)
sortedList -
public E last()
SortedListSortedList.
last in interface SortedList<E>protected static <E> E last(SortedList<E> sortedList)
sortedList -
public SortedList<E> subList(E fromElement,
E toElement)
SortedListSortedList starting by the given fromElement which will be included in
the sublist and ending by the given toElement which will be excluded from the sublist.
subList in interface SortedList<E>fromElement - lower point (inclusive)toElement - higher pint (exclusive)public SortedList<E> headList(E toElement)
SortedListSortedList which starts at the beginning and ends by the given element which itself is
excluded from the head list.
headList in interface SortedList<E>toElement - end element (exclusive)
public SortedList<E> tailList(E fromElement)
SortedListSortedList starting by the given element up to the end including the given element.
tailList in interface SortedList<E>
protected static <E> SortedList<E> subList(SortedList<E> list,
E fromElement,
E toElement)
list - fromElement - toElement -
protected static <E> SortedList<E> headList(SortedList<E> list,
E toElement)
list - toElement -
protected static <E> SortedList<E> tailList(SortedList<E> list,
E fromElement)
list - fromElement -
public SortedList<E> subList(int fromIndex,
int toIndex)
SortedList
subList in interface List<E>subList in interface SortedList<E>subList in class ListAbstract<E>
public void add(int index,
E element)
SortedListSortedList.add(int, Object) ignores the given index position and acts similar to the SortedList.add(Object) method
add in interface List<E>add in interface SortedList<E>
public E set(int index,
E element)
SortedListList.remove(int) to remove the element from the given index position an returns it. The newly given element will NOT
be inserted at the given index position, instead it will be inserted at its right sort position similar to calling the
SortedList.add(Object) method on it.
set in interface List<E>set in interface SortedList<E>public SortedList<E> splitAt(int index)
SortedSplitableListSortedList at the given index position. The current List will retain all elements up to
this index position excluding the index position itself. SortedList will hold all elements starting and including the one at the given index position till the
end of the current List.
splitAt in interface SortedSplitableList<E>protected SortedList<E> newInstance(Collection<E> collection)
SortedList instance
collection -
public E getFirst()
getFirst in interface Deque<E>getFirst in class ListAbstract<E>public E getLast()
getLast in interface Deque<E>getLast in class ListAbstract<E>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||