Class FastArray<T>
java.lang.Object
org.jgroups.util.FastArray<T>
- Type Parameters:
T- T
- All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>, SequencedCollection<T>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanbooleanaddAll(int idx, Collection<? extends T> c) booleanaddAll(Collection<? extends T> list) booleanbooleanfinal booleanbooleanAdds elements from an array els to this arraybooleanintcapacity()protected intcheckIndex(int idx) voidclear()clear(boolean null_elements) booleanbooleancontainsAll(Collection<?> c) intcount()Returns the number of non-null elements, should have the same result as size().booleanprotected booleanequalsArrayList(FastArray<?> other) protected booleanequalsRange(List<?> other, int from, int to) get(int idx) intincrement(int i) intindex()intbooleanisEmpty()iterator()Iterator which iterates only over non-null elements, skipping null elementsIterates over all non-null elements which match filterintlistIterator(int index) print()protected Stringprint(int limit) intprintLimit(int l) remove(int idx) booleanbooleanremoveAll(Collection<?> c) Removes the first non-null element starting at index 0Replaces any or all elements matching filter with a new elementresize(int new_capacity) booleanretainAll(Collection<?> c) intsize()stream()subList(int fromIndex, int toIndex) Object[]toArray()<T1> T1[]toArray(T1[] a) toString()inttransferFrom(FastArray<T> other, boolean clear) Copies the messages from the other array into this one,trimTo(int new_capacity) Attempts to reduce the current capacity to new_capacityMethods inherited from class Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Collection
parallelStream, removeIf, toArrayMethods inherited from interface List
addFirst, addLast, getFirst, getLast, hashCode, replaceAll, reversed, sort, spliterator
-
Field Details
-
elements
-
index
protected int index -
size
protected int size -
increment
protected int increment -
print_limit
protected int print_limit
-
-
Constructor Details
-
FastArray
public FastArray() -
FastArray
public FastArray(int capacity) -
FastArray
-
FastArray
-
-
Method Details
-
capacity
public int capacity() -
index
public int index() -
size
-
isEmpty
-
increment
public int increment() -
increment
-
printLimit
public int printLimit() -
printLimit
-
add
-
add
-
add
-
addAll
Adds elements from an array els to this array- Parameters:
els- The other array, can have null elementslength- The number of elements to add. must be <= els.length- Returns:
- The number of elements added
-
addAll
-
addAll
-
addAll
-
addAll
-
addAll
-
transferFrom
Copies the messages from the other array into this one,including
null elements (usingSystem.arraycopy(Object, int, Object, int, int). This is the same as callingclear(boolean)followed byaddAll(FastArray, boolean), but faster.- Parameters:
other- The other arrayclear- Clears the other array after the transfer when true- Returns:
- The number of non-null elements transferred from other
-
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceList<T>
-
equals
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<T>
-
anyMatch
-
get
-
set
-
set
-
remove
-
remove
-
removeFirst
Removes the first non-null element starting at index 0- Specified by:
removeFirstin interfaceList<T>- Specified by:
removeFirstin interfaceSequencedCollection<T>
-
removeLast
- Specified by:
removeLastin interfaceList<T>- Specified by:
removeLastin interfaceSequencedCollection<T>
-
removeAll
-
removeIf
-
replaceIf
Replaces any or all elements matching filter with a new element- Parameters:
filter- The filter, must ne non-null or no replacements will take placenew_el- The new element, can be nullreplace_all- When false, the method returns after the first match (if any). Otherwise, all matching elements are replaced
-
retainAll
-
clear
-
clear
-
trimTo
-
iterator
-
iterator
Iterates over all non-null elements which match filter -
stream
- Specified by:
streamin interfaceCollection<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
subList
-
toArray
-
toArray
-
count
public int count()Returns the number of non-null elements, should have the same result as size(). Only used for testing! -
toString
-
print
-
resize
-
equalsArrayList
-
equalsRange
-
print
-
checkIndex
protected int checkIndex(int idx)
-