com.starbase.util.collections
Interface Collection

All Known Subinterfaces:
Set
All Known Implementing Classes:
HashtableKeySet

public interface Collection

This interface is intended to parallel the JDK 1.2 Collection interface. Please see the JDK 1.2 documenation for further details.


Method Summary
 boolean add(java.lang.Object o)
          Add the specified element to the collection (optional operation).
 boolean addAll(Collection c)
          Adds all of the elements from the specified collection to this collection (optional operation).
 void clear()
          Removes all of the elements from this collection (optional operation).
 boolean contains(java.lang.Object object)
          Returns true if the collection contains the specified object.
 boolean containsAll(Collection c)
          Returns true is this collection contains all the elements of the specified collection.
 boolean equals(java.lang.Object o)
          Returns true if the specified argument is equal to this collection.
 int hashCode()
          Returns a hash code for this collection.
 boolean isEmpty()
          Returns true if the collection is empty.
 Iterator iterator()
          Returns an iterator for the collection.
 boolean remove(java.lang.Object o)
          Removes an element from the collection (optional operation).
 boolean removeAll(Collection c)
          Removes all the elements of the specified collection from this collection (optional operation).
 boolean retainAll(Collection c)
          Retains only the elements from the specified collection (optional operation).
 int size()
          Returns the size of the collection.
 java.lang.Object[] toArray()
          Returns a new array of elements from the collection.
 java.lang.Object[] toArray(java.lang.Object[] a)
          Returns an array of all the elements from the collection.
 

Method Detail

size

public int size()
Returns the size of the collection.

Returns:
the size of the collection.

isEmpty

public boolean isEmpty()
Returns true if the collection is empty.

Returns:
true if the collection is empty.

contains

public boolean contains(java.lang.Object object)
Returns true if the collection contains the specified object.

Parameters:
object - the object to be tested for containment
Returns:
true if the collection contains the specified object.

iterator

public Iterator iterator()
Returns an iterator for the collection.

Returns:
an iterator for the collection.

toArray

public java.lang.Object[] toArray()
Returns a new array of elements from the collection.

Returns:
a new array of elements from the collection.

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Returns an array of all the elements from the collection. If the specified array is large enough the elements will be stored in it otherwise a new array will be returned.

Parameters:
a - the array in to which the elements will be stored (if big enough)
Returns:
an array of all the elements in the collection.

add

public boolean add(java.lang.Object o)
Add the specified element to the collection (optional operation). Returns true if the collection was modified.

Parameters:
o - the element to add to the collection
Returns:
true if the collection was modified

remove

public boolean remove(java.lang.Object o)
Removes an element from the collection (optional operation). Returns true if the element was actually removed.

Parameters:
o - the element to remove from the collection
Returns:
true if the collection was modified

containsAll

public boolean containsAll(Collection c)
Returns true is this collection contains all the elements of the specified collection.

Parameters:
c - the collection to be checked
Returns:
true if all the elements of the specified collection are contained in this collection.

addAll

public boolean addAll(Collection c)
Adds all of the elements from the specified collection to this collection (optional operation).

Parameters:
c - the collection from which elements are added
Returns:
true if this collection was modified

removeAll

public boolean removeAll(Collection c)
Removes all the elements of the specified collection from this collection (optional operation).

Parameters:
c - the elements to be removed from this collection
Returns:
true if this collection was modified

retainAll

public boolean retainAll(Collection c)
Retains only the elements from the specified collection (optional operation).

Parameters:
c - the elements to be retained for this collection
Returns:
true if this collection was modified

clear

public void clear()
Removes all of the elements from this collection (optional operation).


equals

public boolean equals(java.lang.Object o)
Returns true if the specified argument is equal to this collection.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to be compared for equality
Returns:
true if the specified argument is equal to this collection.

hashCode

public int hashCode()
Returns a hash code for this collection.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this collection.


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.