public class Collection4<T> extends java.lang.Object implements Sequence4<T>, Iterable4<T>, DeepClone, Unversioned
| Constructor and Description |
|---|
Collection4() |
Collection4(int initialLength)
For jdk11 compatibility only.
|
Collection4(Iterable4<T> other) |
Collection4(Iterator4<T> iterator) |
Collection4(T[] elements) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T element)
Adds an element to the end of this collection.
|
void |
addAll(Iterable4<T> other) |
void |
addAll(Iterator4<T> iterator) |
void |
addAll(T[] elements) |
void |
clear() |
boolean |
contains(T element) |
boolean |
containsAll(Iterable4<T> iter) |
boolean |
containsAll(Iterator4<T> iter) |
boolean |
containsByIdentity(T element)
tests if the object is in the Collection.
|
java.lang.Object |
deepClone(java.lang.Object newParent)
The parameter allows passing one new object so parent
references can be corrected on children.
|
T |
ensure(T element)
makes sure the passed object is in the Collection.
|
T |
get(int index) |
T |
get(T element)
returns the first object found in the Collections that equals() the
passed object
|
int |
indexOf(T obj) |
boolean |
isEmpty() |
Iterator4<T> |
iterator()
Iterates through the collection in reversed insertion order which happens
to be the fastest.
|
void |
prepend(T element) |
boolean |
remove(T a_object)
removes an object from the Collection equals() comparison returns the
removed object or null, if none found
|
void |
removeAll(Iterable4<T> iterable)
Removes all the elements from this collection that are returned by
iterable.
|
void |
removeAll(Iterator4<T> iterator)
Removes all the elements from this collection that are returned by
iterator.
|
void |
replace(T oldObject,
T newObject) |
void |
replaceByIdentity(T oldObject,
T newObject) |
T |
singleElement() |
int |
size() |
java.lang.Object[] |
toArray() |
T[] |
toArray(T[] array)
This is a non reflection implementation for more speed.
|
java.lang.String |
toString() |
public Collection4()
public Collection4(int initialLength)
public Collection4(T[] elements)
public T singleElement()
public final boolean add(T element)
public final void prepend(T element)
public final void addAll(T[] elements)
public boolean containsAll(Iterable4<T> iter)
containsAll in interface Sequence4<T>public final boolean containsByIdentity(T element)
public final T get(T element)
public java.lang.Object deepClone(java.lang.Object newParent)
DeepClonepublic final T ensure(T element)
public final Iterator4<T> iterator()
public void removeAll(Iterable4<T> iterable)
iterable - public void removeAll(Iterator4<T> iterator)
public boolean remove(T a_object)
public int indexOf(T obj)
public final T[] toArray(T[] array)
public java.lang.String toString()
toString in class java.lang.Object