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 is optimised for the sizes of 0 and 1,
in which cases it would not allocate array at all.
The tradeoff is the following: this list is slower than ArrayList but occupies less memory in case of 0 or 1 elements.
Please use it only if your code contains many near-empty lists outside the very hot loops.
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanvoidclear()booleanbooleanvoidget(int index) intintiterator()remove(int index) 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, hashCode, lastIndexOf, listIterator, listIterator, removeRange, 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>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceList<E>- Overrides:
clearin classAbstractList<E>
-
set
-
remove
-
iterator
-
sort
-
getModificationCount
public int getModificationCount() -
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
-