public interface ObjectCollection<K> extends java.util.Collection<K>, ObjectIterable<K>
Collection
; provides some additional methods
that use polymorphism to avoid (un)boxing.
Additionally, this class defines strengthens (again) iterator()
and defines
a slightly different semantics for toArray(Object[])
.
Collection
Modifier and Type | Method and Description |
---|---|
ObjectIterator<K> |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
ObjectIterator<K> |
objectIterator()
Deprecated.
As of
fastutil 5, replaced by iterator() . |
<T> T[] |
toArray(T[] a)
Returns an containing the items of this collection;
the runtime type of the returned array is that of the specified array.
|
ObjectIterator<K> iterator()
Note that this specification strengthens the one given in
Iterable.iterator()
, which was already
strengthened in the corresponding type-specific class,
but was weakened by the fact that this interface extends Collection
.
iterator
in interface java.util.Collection<K>
iterator
in interface java.lang.Iterable<K>
iterator
in interface ObjectIterable<K>
@Deprecated ObjectIterator<K> objectIterator()
fastutil
5, replaced by iterator()
.iterator()
<T> T[] toArray(T[] a)
Warning: Note that, contrarily to Collection.toArray(Object[])
, this
methods just writes all elements of this collection: no special
value will be added after the last one.
toArray
in interface java.util.Collection<K>
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])