org.omnaest.utils.structure.collection.list.sorted
Class InsertionSortedList<E>
java.lang.Object
org.omnaest.utils.structure.collection.CollectionAbstract<E>
org.omnaest.utils.structure.collection.list.ListAbstract<E>
org.omnaest.utils.structure.collection.list.sorted.SortedListAbstract<E>
org.omnaest.utils.structure.collection.list.sorted.InsertionSortedList<E>
- Type Parameters:
E -
- All Implemented Interfaces:
- Serializable, Iterable<E>, Collection<E>, Deque<E>, List<E>, Queue<E>, SortedList<E>, SortedSplitableList<E>
public class InsertionSortedList<E>
- extends SortedListAbstract<E>
SortedList implementation using insertion sort algorithm based on a simple ArrayList
- Author:
- Omnaest
- See Also:
- Serialized Form
| Methods inherited from class org.omnaest.utils.structure.collection.list.sorted.SortedListAbstract |
add, comparator, first, first, getFirst, getLast, headList, headList, last, last, set, splitAt, subList, subList, subList, tailList, tailList |
| Methods inherited from class org.omnaest.utils.structure.collection.list.ListAbstract |
addAll, addFirst, addLast, 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 interface java.util.List |
addAll, addAll, contains, containsAll, equals, hashCode, isEmpty, iterator, listIterator, listIterator, remove, removeAll, retainAll, toArray, toArray |
list
protected final List<E> list
InsertionSortedList
public InsertionSortedList()
- See Also:
InsertionSortedList
InsertionSortedList
public InsertionSortedList(Collection<E> collection,
Comparator<E> comparator)
- Parameters:
collection - comparator - - See Also:
InsertionSortedList
InsertionSortedList
public InsertionSortedList(Collection<E> collection)
- Parameters:
collection - - See Also:
InsertionSortedList
InsertionSortedList
public InsertionSortedList(Comparator<E> comparator)
- Parameters:
comparator - - See Also:
InsertionSortedList
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.
size
public int size()
get
public E get(int index)
remove
public E remove(int index)
indexOf
public int indexOf(Object object)
lastIndexOf
public int lastIndexOf(Object object)
newInternalList
protected ArrayList<E> newInternalList()
- Returns a new unsorted
List instance. Per default the ArrayList implementation is used, but this can be
overriden by subclasses
- Returns:
- new
List
clear
public void clear()
- Specified by:
clear in interface Collection<E>- Specified by:
clear in interface List<E>- Overrides:
clear in class ListAbstract<E>
newInstance
protected SortedList<E> newInstance(Collection<E> collection)
- Description copied from class:
SortedListAbstract
- Creates a new
SortedList instance
- Overrides:
newInstance in class SortedListAbstract<E>
- Returns:
Copyright © 2013. All Rights Reserved.