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
Constructors -
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, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
containsAll
-
Constructor Details
-
OrderPreservingList
-
OrderPreservingList
public OrderPreservingList()
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<T extends Comparable<T>>- Specified by:
addin interfaceList<T extends Comparable<T>>- Overrides:
addin classArrayList<T extends Comparable<T>>
-
addAll
- Specified by:
addAllin interfaceCollection<T extends Comparable<T>>- Specified by:
addAllin interfaceList<T extends Comparable<T>>- Overrides:
addAllin classArrayList<T extends Comparable<T>>
-
addAll
- Specified by:
addAllin interfaceList<T extends Comparable<T>>- Overrides:
addAllin classArrayList<T extends Comparable<T>>
-
set
- Specified by:
setin interfaceList<T extends Comparable<T>>- Overrides:
setin classArrayList<T extends Comparable<T>>
-
add
- Specified by:
addin interfaceList<T extends Comparable<T>>- Overrides:
addin classArrayList<T extends Comparable<T>>
-