it.unimi.dsi.fastutil.shorts
Interface ShortCollection

All Superinterfaces:
Collection
All Known Subinterfaces:
ShortList, ShortSet, ShortSortedSet
All Known Implementing Classes:
AbstractShortCollection, AbstractShortList, AbstractShortSet, ShortAVLTreeSet, ShortLinkedOpenHashSet, ShortOpenHashSet, ShortRBTreeSet

public interface ShortCollection
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(short key)
           
 boolean addAll(ShortCollection c)
           
 boolean contains(short key)
           
 boolean containsAll(ShortCollection c)
           
 boolean remove(short key)
           
 boolean removeAll(ShortCollection c)
           
 boolean retainAll(ShortCollection c)
           
 ShortIterator shortIterator()
          Returns a type-specific iterator on the collection.
 short[] toArray(short[] a)
          Builds a primitive type array containing the items of this collection.
 short[] toShortArray()
          Returns a primitive type array containing the items of this collection.
 short[] toShortArray(short[] 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

shortIterator

public ShortIterator shortIterator()
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(short key)
See Also:
Collection.contains(Object)

toShortArray

public 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

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

remove

public boolean remove(short key)
See Also:
Collection.remove(Object)

addAll

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

containsAll

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

removeAll

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

retainAll

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