Package com.db4o.foundation
Class Collection4<T>
- java.lang.Object
-
- com.db4o.foundation.Collection4<T>
-
- All Implemented Interfaces:
DeepClone,Iterable4<T>,Sequence4<T>,Unversioned
public class Collection4<T> extends java.lang.Object implements Sequence4<T>, Iterable4<T>, DeepClone, Unversioned
Fast linked list for all usecases.
-
-
Constructor Summary
Constructors Constructor Description Collection4()Collection4(int initialLength)For jdk11 compatibility only.Collection4(Iterable4<T> other)Collection4(Iterator4<T> iterator)Collection4(T[] elements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T element)Adds an element to the end of this collection.voidaddAll(Iterable4<T> other)voidaddAll(Iterator4<T> iterator)voidaddAll(T[] elements)voidclear()booleancontains(T element)booleancontainsAll(Iterable4<T> iter)booleancontainsAll(Iterator4<T> iter)booleancontainsByIdentity(T element)tests if the object is in the Collection.java.lang.ObjectdeepClone(java.lang.Object newParent)The parameter allows passing one new object so parent references can be corrected on children.Tensure(T element)makes sure the passed object is in the Collection.Tget(int index)Tget(T element)returns the first object found in the Collections that equals() the passed objectintindexOf(T obj)booleanisEmpty()Iterator4<T>iterator()Iterates through the collection in reversed insertion order which happens to be the fastest.voidprepend(T element)booleanremove(T a_object)removes an object from the Collection equals() comparison returns the removed object or null, if none foundvoidremoveAll(Iterable4<T> iterable)Removes all the elements from this collection that are returned by iterable.voidremoveAll(Iterator4<T> iterator)Removes all the elements from this collection that are returned by iterator.voidreplace(T oldObject, T newObject)voidreplaceByIdentity(T oldObject, T newObject)TsingleElement()intsize()java.lang.Object[]toArray()T[]toArray(T[] array)This is a non reflection implementation for more speed.java.lang.StringtoString()
-
-
-
Method Detail
-
singleElement
public T singleElement()
-
add
public final boolean add(T element)
Adds an element to the end of this collection.
-
prepend
public final void prepend(T element)
-
addAll
public final void addAll(T[] elements)
-
containsAll
public boolean containsAll(Iterable4<T> iter)
- Specified by:
containsAllin interfaceSequence4<T>
-
containsByIdentity
public final boolean containsByIdentity(T element)
tests if the object is in the Collection. == comparison.
-
get
public final T get(T element)
returns the first object found in the Collections that equals() the passed object
-
deepClone
public java.lang.Object deepClone(java.lang.Object newParent)
Description copied from interface:DeepCloneThe parameter allows passing one new object so parent references can be corrected on children.
-
ensure
public final T ensure(T element)
makes sure the passed object is in the Collection. equals() comparison.
-
iterator
public final Iterator4<T> iterator()
Iterates through the collection in reversed insertion order which happens to be the fastest.
-
removeAll
public void removeAll(Iterable4<T> iterable)
Removes all the elements from this collection that are returned by iterable.- Parameters:
iterable-
-
removeAll
public void removeAll(Iterator4<T> iterator)
Removes all the elements from this collection that are returned by iterator.
-
remove
public boolean remove(T a_object)
removes an object from the Collection equals() comparison returns the removed object or null, if none found
-
indexOf
public int indexOf(T obj)
-
toArray
public final T[] toArray(T[] array)
This is a non reflection implementation for more speed. In contrast to the JDK behaviour, the passed array has to be initialized to the right length.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-