Package util
Class OrderPreservingList<T extends Comparable<T>>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<T>
util.OrderPreservingList<T>
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,List<T>
,RandomAccess
A LinkedList override to create an order-preserving list to improve speed in a special use case:
You want to remove and add object from/to a list and keep the elements in the list sorted without having to re-sort each time.
You want to remove and add object from/to a list and keep the elements in the list sorted without having to re-sort each time.
- Since:
- 18.06.2021
- Author:
- Juyas
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
-
Method Summary
Methods inherited from class java.util.ArrayList
clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Constructor Details
-
OrderPreservingList
-
OrderPreservingList
public OrderPreservingList()
-
-
Method Details
-
add
- Specified by:
add
in interfaceCollection<T extends Comparable<T>>
- Specified by:
add
in interfaceList<T extends Comparable<T>>
- Overrides:
add
in classArrayList<T extends Comparable<T>>
-
addAll
- Specified by:
addAll
in interfaceCollection<T extends Comparable<T>>
- Specified by:
addAll
in interfaceList<T extends Comparable<T>>
- Overrides:
addAll
in classArrayList<T extends Comparable<T>>
-
addAll
- Specified by:
addAll
in interfaceList<T extends Comparable<T>>
- Overrides:
addAll
in classArrayList<T extends Comparable<T>>
-
set
- Specified by:
set
in interfaceList<T extends Comparable<T>>
- Overrides:
set
in classArrayList<T extends Comparable<T>>
-
add
- Specified by:
add
in interfaceList<T extends Comparable<T>>
- Overrides:
add
in classArrayList<T extends Comparable<T>>
-