org.omnaest.utils.structure.collection.list.sorted
Class SortedListDispatcherSizeBased<E>
java.lang.Object
org.omnaest.utils.structure.collection.list.decorator.ListDispatcher<E>
org.omnaest.utils.structure.collection.list.sorted.SortedListDispatcher<E>
org.omnaest.utils.structure.collection.list.sorted.SortedListDispatcherSizeBased<E>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>, List<E>, SortedList<E>, SortedSplitableList<E>
public class SortedListDispatcherSizeBased<E>
- extends SortedListDispatcher<E>
SortedListDispatcher which is based on the ListDispatcher.size() of the represented virtual SortedList. If the
List exceeds a given size threshold it will switch to the second List if it falls down to a second size
threshold it will switch back to the first List instance.
- Author:
- Omnaest
- See Also:
SortedListDispatcher
| Methods inherited from class org.omnaest.utils.structure.collection.list.decorator.ListDispatcher |
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, set, size, toArray, toArray, toString |
| Methods inherited from interface org.omnaest.utils.structure.collection.list.sorted.SortedList |
set |
| Methods inherited from interface java.util.List |
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size, toArray, toArray |
SortedListDispatcherSizeBased
public SortedListDispatcherSizeBased(SortedList<E> firstList,
SortedList<E> secondList,
int exceedThreshold,
int dropUnderThreshold)
- Parameters:
firstList - secondList - exceedThreshold - dropUnderThreshold - - See Also:
SortedListDispatcherSizeBased
checkDistributionAfterShrink
protected void checkDistributionAfterShrink()
checkDistributionAfterExpansion
protected void checkDistributionAfterExpansion()
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>- Overrides:
splitAt in class SortedListDispatcher<E>
- Returns:
add
public boolean add(E e)
- 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 List<E>- Specified by:
add in interface SortedList<E>- Overrides:
add in class ListDispatcher<E>
- See Also:
List.add(java.lang.Object)
remove
public boolean remove(Object o)
- Specified by:
remove in interface Collection<E>- Specified by:
remove in interface List<E>- Overrides:
remove in class ListDispatcher<E>
- See Also:
List.remove(java.lang.Object)
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll in interface Collection<E>- Specified by:
addAll in interface List<E>- Overrides:
addAll in class ListDispatcher<E>
- See Also:
List.addAll(java.util.Collection)
addAll
public boolean addAll(int index,
Collection<? extends E> c)
- Specified by:
addAll in interface List<E>- Overrides:
addAll in class ListDispatcher<E>
- See Also:
List.addAll(int, java.util.Collection)
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll in interface Collection<E>- Specified by:
removeAll in interface List<E>- Overrides:
removeAll in class ListDispatcher<E>
- See Also:
List.removeAll(java.util.Collection)
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll in interface Collection<E>- Specified by:
retainAll in interface List<E>- Overrides:
retainAll in class ListDispatcher<E>
- See Also:
List.retainAll(java.util.Collection)
clear
public void clear()
- Specified by:
clear in interface Collection<E>- Specified by:
clear in interface List<E>- Overrides:
clear in class ListDispatcher<E>
- See Also:
List.clear()
add
public void add(int index,
E element)
- Description copied from interface:
SortedList
- The
SortedList.add(int, Object) ignores the given index position and acts similar to the SortedList.add(Object) method
- Specified by:
add in interface List<E>- Specified by:
add in interface SortedList<E>- Overrides:
add in class ListDispatcher<E>
- See Also:
List.add(int, java.lang.Object)
remove
public E remove(int index)
- Specified by:
remove in interface List<E>- Overrides:
remove in class ListDispatcher<E>
- See Also:
List.remove(int)
Copyright © 2013. All Rights Reserved.