java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.intellij.util.SmartList<E>
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,RandomAccess
A List which with optimized memory usage for the sizes of 0 and 1,
in which cases it does not allocate an array.
The tradeoff is the following: This list is slower than ArrayList but occupies less memory in case of exactly 1 element.
Please use it only if your code contains many 1-element lists outside very hot loops.
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanbooleanvoidget(int index) intDeprecated.do not useintiterator()remove(int index) protected voidremoveRange(int fromIndex, int toIndex) intsize()voidsort(Comparator<? super E> comparator) <T> T @NotNull []toArray(T @NotNull [] a) voidTrims the capacity of this list to be the list's current size.Methods inherited from class java.util.AbstractList
addAll, clear, hashCode, lastIndexOf, listIterator, listIterator, subListMethods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, spliterator, toArray
-
Constructor Details
-
SmartList
public SmartList() -
SmartList
-
SmartList
-
SmartList
-
-
Method Details
-
get
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceList<E>- Overrides:
addin classAbstractList<E>
-
add
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein classAbstractCollection<E>
-
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRangein classAbstractList<E>
-
set
-
remove
-
iterator
-
sort
-
getModificationCount
Deprecated.do not use -
toArray
public <T> T @NotNull [] toArray(T @NotNull [] a) - Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceList<E>- Overrides:
toArrayin classAbstractCollection<E>
-
trimToSize
public void trimToSize()Trims the capacity of this list to be the list's current size. An application can use this operation to minimize the storage of a list instance. -
indexOf
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceList<E>- Overrides:
containsin classAbstractCollection<E>
-
equals
- Specified by:
equalsin interfaceCollection<E>- Specified by:
equalsin interfaceList<E>- Overrides:
equalsin classAbstractList<E>
-
forEach
-