it.unimi.dsi.fastutil.longs
Interface LongCollection

All Superinterfaces:
Collection
All Known Subinterfaces:
LongList, LongSet, LongSortedSet
All Known Implementing Classes:
AbstractLongCollection, AbstractLongList, AbstractLongSet, AbstractLongSortedSet, Collections.EmptyCollection, Lists.EmptyList, LongAVLTreeSet, LongCollections.SynchronizedCollection, LongCollections.UnmodifiableCollection, LongLinkedOpenHashSet, LongLists.SynchronizedList, LongLists.UnmodifiableList, LongOpenHashSet, LongRBTreeSet, LongSets.SynchronizedSet, LongSets.UnmodifiableSet, LongSortedSets.Singleton, LongSortedSets.SynchronizedSortedSet, LongSortedSets.UnmodifiableSortedSet, Sets.EmptySet

public interface LongCollection
extends Collection

A type-specific Collection; provides some additional methods that use polymorphism to reduce type juggling.

Note that iterators provided by classes implementing this interface must be type specific.

See Also:
Collection

Method Summary
 boolean add(long key)
           
 boolean addAll(LongCollection c)
           
 boolean contains(long key)
           
 boolean containsAll(LongCollection c)
           
 LongIterator longIterator()
          Returns a type-specific iterator on the collection.
 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)
          Builds a primitive type array containing the items of this collection.
 long[] toLongArray()
          Returns a primitive type array containing the items of this collection.
 long[] toLongArray(long[] a)
          Builds 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, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

longIterator

public LongIterator longIterator()
Returns a type-specific iterator on the collection.

The iterator returned by the Collection.iterator() method and by this method are identical; however, using this method you can save a type casting.

Since:
2.51
See Also:
Collection.iterator()

contains

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

toLongArray

public 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

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

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

toArray

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

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

add

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

rem

public 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

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

containsAll

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

removeAll

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

retainAll

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