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 TypeMethodDescriptionvoid
boolean
Add an element to the end of the listboolean
addAll
(int index, Collection<? extends T> c) boolean
addAll
(Collection<? extends T> c) void
clear()
Clears the list by setting the size to zero.boolean
boolean
containsAll
(Collection<?> c) get
(int index) Return an element at index.int
boolean
isEmpty()
iterator()
int
listIterator
(int index) partition
(int count) Returns view partitions on the underlying list.remove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
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, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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:
containsAll
in interfaceCollection<T>
- Specified by:
containsAll
in interfaceList<T>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<T>
-
listIterator
- Specified by:
listIterator
in interfaceList<T>
-
listIterator
- Specified by:
listIterator
in interfaceList<T>
-
subList
-