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 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 objectint
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 foundvoid
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()
-
-
-
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:
containsAll
in 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:DeepClone
The 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:
toString
in classjava.lang.Object
-
-