edu.emory.mathcs.util.collections.shorts
Class AbstractShortCollection

java.lang.Object
  extended byedu.emory.mathcs.util.collections.shorts.AbstractShortCollection
All Implemented Interfaces:
ShortCollection
Direct Known Subclasses:
AbstractShortSet, ShortArrayList

public abstract class AbstractShortCollection
extends java.lang.Object
implements ShortCollection

Version:
1.0
Author:
Dawid Kurzyniec

Constructor Summary
AbstractShortCollection()
           
 
Method Summary
 boolean add(short e)
          Attempts to add the specified number to this collection.
 boolean addAll(ShortCollection c)
          Attempts to add to this collection all the numbers contained in the specified collection.
 void clear()
          Removes all the numbers from this collection.
 boolean contains(short e)
          Returns true if this collection contains specified number; false otherwise.
 boolean containsAll(ShortCollection c)
          Returns true if this collection contains all the numbers from collection c; false otherwise.
 boolean isEmpty()
          Returns true if this collection is empty; false otherwise.
abstract  ShortIterator iterator()
          Returns the iterator over numbers contained in this collection.
 boolean remove(short e)
          Attempts to remove the specified number from this collection.
 boolean removeAll(ShortCollection c)
          Attempts to remove from this collection all the numbers contained in the specified collection.
 boolean retainAll(ShortCollection c)
          Attempts to remove from this collection all the numbers not contained in the specified collection.
 int size()
          Returns the number of elements in this collection.
 short[] toArray()
          Returns the newly allocated array containing all numbers from this collection, in the order returned by its iterator.
 short[] toArray(short[] a)
          Returns an array containing all of the numbers in this collection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.emory.mathcs.util.collections.shorts.ShortCollection
equals, hashCode
 

Constructor Detail

AbstractShortCollection

public AbstractShortCollection()
Method Detail

size

public int size()
Description copied from interface: ShortCollection
Returns the number of elements in this collection.

Specified by:
size in interface ShortCollection

isEmpty

public boolean isEmpty()
Description copied from interface: ShortCollection
Returns true if this collection is empty; false otherwise.

Specified by:
isEmpty in interface ShortCollection
Returns:
true if this collection is empty; false otherwise

contains

public boolean contains(short e)
Description copied from interface: ShortCollection
Returns true if this collection contains specified number; false otherwise.

Specified by:
contains in interface ShortCollection
Returns:
true if this collection contains specified number; false otherwise

iterator

public abstract ShortIterator iterator()
Description copied from interface: ShortCollection
Returns the iterator over numbers contained in this collection.

Specified by:
iterator in interface ShortCollection
Returns:
the iterator over numbers contained in this collection.

toArray

public short[] toArray()
Description copied from interface: ShortCollection
Returns the newly allocated array containing all numbers from this collection, in the order returned by its iterator.

Specified by:
toArray in interface ShortCollection
Returns:
the array containing all numbers from this collection

toArray

public short[] toArray(short[] a)
Description copied from interface: ShortCollection
Returns an array containing all of the numbers in this collection. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated.

If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.

Like the ShortCollection.toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method may, under certain circumstances, be used to save allocation costs.

Specified by:
toArray in interface ShortCollection
Parameters:
a - the array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array is allocated for this purpose.
Returns:
an array containing all the elements in this collection

add

public boolean add(short e)
Description copied from interface: ShortCollection
Attempts to add the specified number to this collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
add in interface ShortCollection
Parameters:
e - number to be added to this collection
Returns:
true if this collection was modified as a result of this call

remove

public boolean remove(short e)
Description copied from interface: ShortCollection
Attempts to remove the specified number from this collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
remove in interface ShortCollection
Parameters:
e - number to be removed from this collection
Returns:
true if this collection was modified as a result of this call

containsAll

public boolean containsAll(ShortCollection c)
Description copied from interface: ShortCollection
Returns true if this collection contains all the numbers from collection c; false otherwise.

Specified by:
containsAll in interface ShortCollection
Returns:
true if this collection contains all numbers from c; false otherwise

addAll

public boolean addAll(ShortCollection c)
Description copied from interface: ShortCollection
Attempts to add to this collection all the numbers contained in the specified collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
addAll in interface ShortCollection
Parameters:
c - a collection of numbers to be added to this collection
Returns:
true if this collection was modified as a result of this call

retainAll

public boolean retainAll(ShortCollection c)
Description copied from interface: ShortCollection
Attempts to remove from this collection all the numbers not contained in the specified collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
retainAll in interface ShortCollection
Parameters:
c - a collection of numbers to be retained in this collection
Returns:
true if this collection was modified as a result of this call

removeAll

public boolean removeAll(ShortCollection c)
Description copied from interface: ShortCollection
Attempts to remove from this collection all the numbers contained in the specified collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
removeAll in interface ShortCollection
Parameters:
c - a collection of numbers to be removed from this collection
Returns:
true if this collection was modified as a result of this call

clear

public void clear()
Description copied from interface: ShortCollection
Removes all the numbers from this collection.

Specified by:
clear in interface ShortCollection

toString

public java.lang.String toString()