Package com.xceptance.xlt.api.util
Class SimpleArrayList<T>
java.lang.Object
com.xceptance.xlt.api.util.SimpleArrayList<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,SequencedCollection<T>
Inexpensive (partial) list implementation. Not fully implemented, just what is needed. As soon as iterators and other
things are involved, the memory savings we wanted are gone.
Minimal checks for data correctness!! This is tuned for speed not elegance or safety.
- Since:
- 7.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanAdd an element to the end of the listbooleanaddAll(int index, Collection<? extends T> c) booleanaddAll(Collection<? extends T> c) voidclear()Clears the list by setting the size to zero.booleanbooleancontainsAll(Collection<?> c) get(int index) Return an element at index.intbooleanisEmpty()iterator()intlistIterator(int index) partition(int count) Returns view partitions on the underlying list.remove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()Returns the size of this listsubList(int fromIndex, int toIndex) Object[]toArray()Creates an array of the elements.<T> T[]toArray(T[] array) Creates an array of the elements.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, sort, spliterator
-
Constructor Details
-
SimpleArrayList
public SimpleArrayList(int capacity) Create a new list with a default capacity.- Parameters:
capacity- the capacity
-
-
Method Details
-
add
Add an element to the end of the list -
get
Return an element at index. No range checks at all. -
size
public int size()Returns the size of this list -
toArray
Creates an array of the elements. This is a copy operation! -
toArray
public <T> T[] toArray(T[] array) Creates an array of the elements. This is a copy operation! -
clear
public void clear()Clears the list by setting the size to zero. It does not release any elements for performance purposes. -
partition
Returns view partitions on the underlying list. If the count is larger than size you get back the maximum possible list number with one element each. If count is 0 or smaller, we correct it to 1.- Parameters:
count- how many list do we want- Returns:
- a list of lists
-
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceList<T>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
subList
-