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

java.lang.Object
  extended by org.omnaest.utils.structure.collection.CollectionAbstract<E>
      extended by org.omnaest.utils.structure.collection.list.ListAbstract<E>
          extended by org.omnaest.utils.structure.collection.list.ListAbstract.ListAbstractSublist<E>
              extended by org.omnaest.utils.structure.collection.list.sorted.SortedListAbstract.SortedListAbstractSublist<E>
Type Parameters:
E -
All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, Deque<E>, List<E>, Queue<E>, SortedList<E>
Enclosing class:
SortedListAbstract<E>

protected static class SortedListAbstract.SortedListAbstractSublist<E>
extends ListAbstract.ListAbstractSublist<E>
implements SortedList<E>

Sublist implementation for SortedListAbstract

Author:
Omnaest
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.omnaest.utils.structure.collection.list.ListAbstract
ListAbstract.ListAbstractSublist<E>
 
Field Summary
 
Fields inherited from class org.omnaest.utils.structure.collection.list.ListAbstract.ListAbstractSublist
fromIndex, parentList, toIndex
 
Constructor Summary
SortedListAbstract.SortedListAbstractSublist(SortedList<E> parentList, int fromIndex, int toIndex)
           
 
Method Summary
 boolean add(E element)
          This does add the given element at the right order position.
 Comparator<? super E> comparator()
          Returns the Comparator used by this SortedList
 E first()
          Returns the first (lowest) element currently in this SortedList.
 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> 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.ListAbstract.ListAbstractSublist
add, get, indexOf, lastIndexOf, remove, set, size
 
Methods inherited from class org.omnaest.utils.structure.collection.list.ListAbstract
addAll, addFirst, addLast, clear, contains, descendingIterator, element, getFirst, getLast, 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, 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

SortedListAbstract.SortedListAbstractSublist

public SortedListAbstract.SortedListAbstractSublist(SortedList<E> parentList,
                                                    int fromIndex,
                                                    int toIndex)
Parameters:
parentList -
fromIndex -
toIndex -
See Also:
SortedListAbstract.SortedListAbstractSublist
Method Detail

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)

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 ListAbstract.ListAbstractSublist<E>

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>

add

public boolean add(E element)
Description copied from interface: SortedList
This does add the given element at the right order position. This does break the contract of the Collection interface, since the new element is not appended to the Collection.

Specified by:
add in interface Collection<E>
Specified by:
add in interface Deque<E>
Specified by:
add in interface List<E>
Specified by:
add in interface Queue<E>
Specified by:
add in interface SortedList<E>
Overrides:
add in class ListAbstract.ListAbstractSublist<E>


Copyright © 2013. All Rights Reserved.