-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable,java.util.Collection,java.util.List,java.util.RandomAccess
public class LimitedSortedList<T extends Comparable<T>> extends ArrayList<T>
This class features are: * Supports only types implementing interface < * All new items are automatically added in order based on compareTo * No duplicate items are allowed. (Based on equals method) * Some default ArrayList methods are not supported * Has method that is removing items after they are read cutFirst * All supported methods that write or read should be 'synchronised'; pleas check that method that you are using is synchronised
-
-
Constructor Summary
Constructors Constructor Description LimitedSortedList(int maxCount)
-
Method Summary
Modifier and Type Method Description synchronized booleanadd(T newItem)synchronized List<T>cutFirst(int count)Reads first N items and deletes them from array synchronized voidremoveItemThatAreLessThen(T item)synchronized booleanisEmpty()synchronized intsize()synchronized voidclear()voidadd(int index, T element)booleanaddAll(Collection<out T> c)booleanaddAll(int index, Collection<out T> c)-
Methods inherited from class java.util.ArrayList
add, add, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize -
Methods inherited from class java.util.AbstractList
equals, hashCode -
Methods inherited from class java.util.AbstractCollection
containsAll, toString -
Methods inherited from class java.util.Collection
parallelStream, stream -
Methods inherited from class java.lang.Iterable
iterator, spliterator -
Methods inherited from class java.util.List
copyOf, of -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
cutFirst
synchronized List<T> cutFirst(int count)
Reads first N items and deletes them from array
- Parameters:
count- number of items to be read and removed from the array
-
removeItemThatAreLessThen
synchronized void removeItemThatAreLessThen(T item)
-
isEmpty
synchronized boolean isEmpty()
-
size
synchronized int size()
-
clear
synchronized void clear()
-
add
@Deprecated() void add(int index, T element)
-
addAll
@Deprecated() boolean addAll(Collection<out T> c)
-
addAll
@Deprecated() boolean addAll(int index, Collection<out T> c)
-
-
-
-