java.util
Interface Set

All Superinterfaces:
Collection, Iterable
All Known Implementing Classes:
HashSet

public interface Set
extends Collection


Method Summary
 boolean add(Object o)
          Attempts to add object to the contents of this Collection.
 void clear()
          Removes all elements from this Collection, leaving it empty.
 boolean contains(Object o)
          Searches this Collection for the specified object.
 boolean containsAll(Collection c)
          Searches this Collection for all objects in the specified Collection.
 Iterator iterator()
          Returns an instance of Iterator that may be used to access the objects contained by this collection.
 boolean remove(Object o)
          Removes the first occurrence of the specified object from this Collection.
 Object[] toArray()
          Answers a new array containing all elements contained in this Collection.
 
Methods inherited from interface java.util.Collection
addAll, equals, hashCode, isEmpty, removeAll, retainAll, size, toArray
 

Method Detail

add

boolean add(Object o)
Description copied from interface: Collection
Attempts to add object to the contents of this Collection.

Specified by:
add in interface Collection
Parameters:
o - the object to add
Returns:
true if this Collection is modified, false otherwise

remove

boolean remove(Object o)
Description copied from interface: Collection
Removes the first occurrence of the specified object from this Collection.

Specified by:
remove in interface Collection
Parameters:
o - the object to remove
Returns:
true if this Collection is modified, false otherwise

contains

boolean contains(Object o)
Description copied from interface: Collection
Searches this Collection for the specified object.

Specified by:
contains in interface Collection
Parameters:
o - the object to search for
Returns:
true if object is an element of this Collection, false otherwise

iterator

Iterator iterator()
Description copied from interface: Collection
Returns an instance of Iterator that may be used to access the objects contained by this collection.

Specified by:
iterator in interface Collection
Specified by:
iterator in interface Iterable
Returns:
an iterator for accessing the collection contents

toArray

Object[] toArray()
Description copied from interface: Collection
Answers a new array containing all elements contained in this Collection.

Specified by:
toArray in interface Collection
Returns:
an array of the elements from this Collection

clear

void clear()
Description copied from interface: Collection
Removes all elements from this Collection, leaving it empty.

Specified by:
clear in interface Collection
See Also:
Collection.isEmpty(), Collection.size()

containsAll

boolean containsAll(Collection c)
Description copied from interface: Collection
Searches this Collection for all objects in the specified Collection.

Specified by:
containsAll in interface Collection
Parameters:
c - the Collection of objects
Returns:
true if all objects in the specified Collection are elements of this Collection, false otherwise