it.unimi.dsi.fastutil.shorts
Interface ShortCollection

All Superinterfaces:
java.util.Collection<java.lang.Short>, java.lang.Iterable<java.lang.Short>, ShortIterable
All Known Subinterfaces:
ShortBigList, ShortList, ShortSet, ShortSortedSet
All Known Implementing Classes:
AbstractShortBigList, AbstractShortBigList.ShortSubList, AbstractShortCollection, AbstractShortList, AbstractShortList.ShortSubList, AbstractShortSet, AbstractShortSortedSet, ShortArrayList, ShortArraySet, ShortAVLTreeSet, ShortBigArrayBigList, ShortBigLists.EmptyBigList, ShortBigLists.ListBigList, ShortBigLists.Singleton, ShortBigLists.SynchronizedBigList, ShortBigLists.UnmodifiableBigList, ShortCollections.EmptyCollection, ShortCollections.IterableCollection, ShortCollections.SynchronizedCollection, ShortCollections.UnmodifiableCollection, ShortLinkedOpenCustomHashSet, ShortLinkedOpenHashSet, ShortLists.EmptyList, ShortLists.Singleton, ShortLists.SynchronizedList, ShortLists.UnmodifiableList, ShortOpenCustomHashSet, ShortOpenHashSet, ShortRBTreeSet, ShortSets.EmptySet, ShortSets.Singleton, ShortSets.SynchronizedSet, ShortSets.UnmodifiableSet, ShortSortedSets.EmptySet, ShortSortedSets.Singleton, ShortSortedSets.SynchronizedSortedSet, ShortSortedSets.UnmodifiableSortedSet

public interface ShortCollection
extends java.util.Collection<java.lang.Short>, ShortIterable

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(short key)
           
 boolean addAll(ShortCollection c)
           
 boolean contains(short key)
           
 boolean containsAll(ShortCollection c)
           
 ShortIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean rem(short 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(ShortCollection c)
           
 boolean retainAll(ShortCollection c)
           
 ShortIterator shortIterator()
          Deprecated. As of fastutil 5, replaced by iterator().
 short[] toArray(short[] 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.
 short[] toShortArray()
          Returns a primitive type array containing the items of this collection.
 short[] toShortArray(short[] 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

ShortIterator 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 java.util.Collection<java.lang.Short>
Specified by:
iterator in interface java.lang.Iterable<java.lang.Short>
Specified by:
iterator in interface ShortIterable
Returns:
a type-specific iterator on the elements of this collection.

shortIterator

@Deprecated
ShortIterator shortIterator()
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 java.util.Collection<java.lang.Short>
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(short key)
See Also:
Collection.contains(Object)

toShortArray

short[] toShortArray()
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()

toShortArray

short[] toShortArray(short[] 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

short[] toArray(short[] 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(short key)
See Also:
Collection.add(Object)

rem

boolean rem(short 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(ShortCollection c)
See Also:
Collection.addAll(Collection)

containsAll

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

removeAll

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

retainAll

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