org.omnaest.utils.structure.collection.list.sorted
Class SortedListDispatcher<E>

java.lang.Object
  extended by org.omnaest.utils.structure.collection.list.decorator.ListDispatcher<E>
      extended by org.omnaest.utils.structure.collection.list.sorted.SortedListDispatcher<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, SortedList<E>, SortedSplitableList<E>
Direct Known Subclasses:
SortedListDispatcherSizeBased

public abstract class SortedListDispatcher<E>
extends ListDispatcher<E>
implements SortedSplitableList<E>

Similar to ListDispatcher but for SortedLists

Author:
Omnaest

Nested Class Summary
 
Nested classes/interfaces inherited from class org.omnaest.utils.structure.collection.list.decorator.ListDispatcher
ListDispatcher.ListDispatchControl<E>
 
Field Summary
 
Fields inherited from class org.omnaest.utils.structure.collection.list.decorator.ListDispatcher
listDispatchControl
 
Constructor Summary
SortedListDispatcher(SortedList<E>... lists)
           
 
Method Summary
 Comparator<? super E> comparator()
          Returns the Comparator used by this SortedList
 E first()
          Returns the first (lowest) element currently in this SortedList.
protected  SortedSplitableList<E> getList()
           
 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.
 E last()
          Returns the last (highest) element currently in this SortedList.
 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)
 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.
 
Methods inherited from class org.omnaest.utils.structure.collection.list.decorator.ListDispatcher
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, 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, add, set
 
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
 

Constructor Detail

SortedListDispatcher

public SortedListDispatcher(SortedList<E>... lists)
Parameters:
lists -
See Also:
SortedListDispatcher
Method Detail

getList

protected SortedSplitableList<E> getList()
Overrides:
getList in class ListDispatcher<E>
Returns:

comparator

public Comparator<? super E> comparator()
Description copied from interface: SortedList
Returns the Comparator used by this SortedList

Specified by:
comparator in interface SortedList<E>
Returns:

subList

public SortedList<E> subList(E fromElement,
                             E toElement)
Description copied from interface: SortedList
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.

Specified by:
subList in interface SortedList<E>
Parameters:
fromElement - lower point (inclusive)
toElement - higher pint (exclusive)

headList

public SortedList<E> headList(E toElement)
Description copied from interface: SortedList
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.

Specified by:
headList in interface SortedList<E>
Parameters:
toElement - end element (exclusive)
Returns:

tailList

public SortedList<E> tailList(E fromElement)
Description copied from interface: SortedList
Returns a view to the current SortedList starting by the given element up to the end including the given element.

Specified by:
tailList in interface SortedList<E>
Returns:

first

public E first()
Description copied from interface: SortedList
Returns the first (lowest) element currently in this SortedList.

Specified by:
first in interface SortedList<E>

last

public E last()
Description copied from interface: SortedList
Returns the last (highest) element currently in this SortedList.

Specified by:
last in interface SortedList<E>

splitAt

public SortedList<E> splitAt(int index)
Description copied from interface: SortedSplitableList
Splits the current SortedList at the given index position. The current List will retain all elements up to this index position excluding the index position itself.
The returned SortedList will hold all elements starting and including the one at the given index position till the end of the current List.

Specified by:
splitAt in interface SortedSplitableList<E>
Returns:

subList

public SortedList<E> subList(int fromIndex,
                             int toIndex)
Description copied from interface: SortedList
Similar to List#subList(int, int)

Specified by:
subList in interface List<E>
Specified by:
subList in interface SortedList<E>
Overrides:
subList in class ListDispatcher<E>
See Also:
List.subList(int, int)


Copyright © 2013. All Rights Reserved.