edu.emory.mathcs.util.collections.ints
Interface IntCollection

All Known Subinterfaces:
IntInterval, IntList, IntSet, IntSortedSet
All Known Implementing Classes:
AbstractIntCollection, AbstractIntInterval, AbstractIntSet, AbstractIntSortedSet, IntArrayList

public interface IntCollection

Version:
1.0
Author:
Dawid Kurzyniec

Method Summary
 boolean add(int e)
          Attempts to add the specified number to this collection.
 boolean addAll(IntCollection 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(int e)
          Returns true if this collection contains specified number; false otherwise.
 boolean containsAll(IntCollection c)
          Returns true if this collection contains all the numbers from collection c; false otherwise.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 boolean isEmpty()
          Returns true if this collection is empty; false otherwise.
 IntIterator iterator()
          Returns the iterator over numbers contained in this collection.
 boolean remove(int e)
          Attempts to remove the specified number from this collection.
 boolean removeAll(IntCollection c)
          Attempts to remove from this collection all the numbers contained in the specified collection.
 boolean retainAll(IntCollection 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.
 int size64()
          Returns the number of elements in this collection.
 int[] toArray()
          Returns the newly allocated array containing all numbers from this collection, in the order returned by its iterator.
 int[] toArray(int[] a)
          Returns an array containing all of the numbers in this collection.
 

Method Detail

size

public int size()
Returns the number of elements in this collection. If exceeds Integer.MAX_VALUE, then Integer.MAX_VALUE is returned.


size64

public int size64()
Returns the number of elements in this collection.


isEmpty

public boolean isEmpty()
Returns true if this collection is empty; false otherwise.

Returns:
true if this collection is empty; false otherwise

contains

public boolean contains(int e)
Returns true if this collection contains specified number; false otherwise.

Returns:
true if this collection contains specified number; false otherwise

iterator

public IntIterator iterator()
Returns the iterator over numbers contained in this collection.

Returns:
the iterator over numbers contained in this collection.

toArray

public int[] toArray()
Returns the newly allocated array containing all numbers from this collection, in the order returned by its iterator.

Returns:
the array containing all numbers from this collection

toArray

public int[] toArray(int[] a)
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 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.

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
Throws:
java.lang.NullPointerException - if the specified array is null

add

public boolean add(int e)
Attempts to add the specified number to this collection. Returns true if the collection was modified as a result of this call; false otherwise.

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(int e)
Attempts to remove the specified number from this collection. Returns true if the collection was modified as a result of this call; false otherwise.

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(IntCollection c)
Returns true if this collection contains all the numbers from collection c; false otherwise.

Returns:
true if this collection contains all numbers from c; false otherwise

addAll

public boolean addAll(IntCollection c)
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.

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

removeAll

public boolean removeAll(IntCollection c)
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.

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

retainAll

public boolean retainAll(IntCollection c)
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.

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

clear

public void clear()
Removes all the numbers from this collection.


equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()