it.unimi.dsi.fastutil.longs
Interface LongCollection

All Superinterfaces:
Collection<Long>, Iterable<Long>, LongIterable
All Known Subinterfaces:
LongBigList, LongList, LongSet, LongSortedSet
All Known Implementing Classes:
AbstractLongBigList, AbstractLongBigList.LongSubList, AbstractLongCollection, AbstractLongList, AbstractLongList.LongSubList, AbstractLongSet, AbstractLongSortedSet, LongArrayList, LongArraySet, LongAVLTreeSet, LongBigArrayBigList, LongBigLists.EmptyBigList, LongBigLists.ListBigList, LongBigLists.Singleton, LongBigLists.SynchronizedBigList, LongBigLists.UnmodifiableBigList, LongCollections.EmptyCollection, LongCollections.IterableCollection, LongCollections.SynchronizedCollection, LongCollections.UnmodifiableCollection, LongLinkedOpenCustomHashSet, LongLinkedOpenHashSet, LongLists.EmptyList, LongLists.Singleton, LongLists.SynchronizedList, LongLists.UnmodifiableList, LongOpenCustomHashSet, LongOpenHashBigSet, LongOpenHashSet, LongRBTreeSet, LongSets.EmptySet, LongSets.Singleton, LongSets.SynchronizedSet, LongSets.UnmodifiableSet, LongSortedSets.EmptySet, LongSortedSets.Singleton, LongSortedSets.SynchronizedSortedSet, LongSortedSets.UnmodifiableSortedSet

public interface LongCollection
extends Collection<Long>, LongIterable

A type-specific 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[]).

See Also:
Collection

Method Summary
 boolean add(long key)
           
 boolean addAll(LongCollection c)
           
 boolean contains(long key)
           
 boolean containsAll(LongCollection c)
           
 LongIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 LongIterator longIterator()
          Deprecated. As of fastutil 5, replaced by iterator().
 boolean rem(long key)
          Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name.
 boolean removeAll(LongCollection c)
           
 boolean retainAll(LongCollection c)
           
 long[] toArray(long[] a)
          Returns a primitive type array containing the items of this collection.
<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.
 long[] toLongArray()
          Returns a primitive type array containing the items of this collection.
 long[] toLongArray(long[] a)
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray
 

Method Detail

iterator

LongIterator iterator()
Returns a type-specific iterator on the elements of this collection.

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.

Specified by:
iterator in interface Collection<Long>
Specified by:
iterator in interface Iterable<Long>
Specified by:
iterator in interface LongIterable
Returns:
a type-specific iterator on the elements of this collection.

longIterator

@Deprecated
LongIterator longIterator()
Deprecated. As of fastutil 5, replaced by iterator().

Returns a type-specific iterator on this elements of this collection.

See Also:
iterator()

toArray

<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.

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.

Specified by:
toArray in interface Collection<Long>
Parameters:
a - if this array is big enough, it will be used to store this collection.
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray(Object[])

contains

boolean contains(long key)
See Also:
Collection.contains(Object)

toLongArray

long[] toLongArray()
Returns a primitive type array containing the items of this collection.

Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

toLongArray

long[] toLongArray(long[] a)
Returns a primitive type array containing the items of this collection.

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.

Parameters:
a - if this array is big enough, it will be used to store this collection.
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray(Object[])

toArray

long[] toArray(long[] a)
Returns a primitive type array containing the items of this collection.

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.

Parameters:
a - if this array is big enough, it will be used to store this collection.
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray(Object[])

add

boolean add(long key)
See Also:
Collection.add(Object)

rem

boolean rem(long key)
Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name. For simplicity, the set interfaces reinstates remove().

See Also:
Collection.remove(Object)

addAll

boolean addAll(LongCollection c)
See Also:
Collection.addAll(Collection)

containsAll

boolean containsAll(LongCollection c)
See Also:
Collection.containsAll(Collection)

removeAll

boolean removeAll(LongCollection c)
See Also:
Collection.removeAll(Collection)

retainAll

boolean retainAll(LongCollection c)
See Also:
Collection.retainAll(Collection)