com.starbase.util.collections
Interface Set

All Superinterfaces:
Collection
All Known Implementing Classes:
HashtableKeySet

public interface Set
extends Collection

This interface is intended to parallel the JDK 1.2 Set interface. A set is a collection that does not contain redundant elements. Please see the JDK 1.2 documenation for further details.


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

Method Detail

size

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

Specified by:
size in interface Collection
Returns:
the size of the set.

isEmpty

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

Specified by:
isEmpty in interface Collection
Returns:
true if the set is empty.

contains

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

Specified by:
contains in interface Collection
Parameters:
object - the object to be tested for containment
Returns:
true if the set contains the specified object.

iterator

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

Specified by:
iterator in interface Collection
Returns:
an iterator for the set.

toArray

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

Specified by:
toArray in interface Collection
Returns:
a new array of elements from the set.

toArray

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

Specified by:
toArray in interface Collection
Parameters:
a - the array in to which the elements will be stored (if big enough)
Returns:
an array of all the elements in the set.

add

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

Specified by:
add in interface Collection
Parameters:
o - the element to add to the set
Returns:
true if the set was modified

remove

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

Specified by:
remove in interface Collection
Parameters:
o - the element to remove from the set
Returns:
true if the set was modified

containsAll

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

Specified by:
containsAll in interface Collection
Parameters:
c - the collection to be checked
Returns:
true if all the elements of the specified set are contained in this set.

addAll

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

Specified by:
addAll in interface Collection
Parameters:
c - the collection from which elements are added
Returns:
true if this set was modified

removeAll

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

Specified by:
removeAll in interface Collection
Parameters:
c - the elements to be removed from this set
Returns:
true if this set was modified

retainAll

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

Specified by:
retainAll in interface Collection
Parameters:
c - the elements to be retained for this set
Returns:
true if this set was modified

clear

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

Specified by:
clear in interface Collection

equals

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

Specified by:
equals in interface 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 set.

hashCode

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

Specified by:
hashCode in interface Collection
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this set.


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