Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

oracle.adfnmc.java.util
Interface Set

All Superinterfaces:
Collection, Iterable
All Known Subinterfaces:
SortedSet
All Known Implementing Classes:
AbstractSet, EntityRowSetImpl, HashSet, TreeSet

public interface Set
extends Collection

Set is a collection which does not allow duplicate elements.

Since:
1.2

Method Summary
 boolean add(java.lang.Object object)
          Adds the specified object to this Set.
 boolean addAll(Collection collection)
          Adds the objects in the specified Collection which do not exist in this Set.
 void clear()
          Removes all elements from this Set, leaving it empty.
 boolean contains(java.lang.Object object)
          Searches this Set for the specified object.
 boolean containsAll(Collection collection)
          Searches this Set for all objects in the specified Collection.
 boolean equals(java.lang.Object object)
          Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
 int hashCode()
          Answers an integer hash code for the receiver.
 boolean isEmpty()
          Answers if this Set has no elements, a size of zero.
 Iterator iterator()
          Answers an Iterator on the elements of this Set.
 boolean remove(java.lang.Object object)
          Removes any occurrence of the specified object from this Set.
 boolean removeAll(Collection collection)
          Removes all objects in the specified Collection from this Set.
 boolean retainAll(Collection collection)
          Removes all objects from this Set that are not contained in the specified Collection.
 int size()
          Answers the number of elements in this Set.
 java.lang.Object[] toArray()
          Answers an array containing all elements contained in this Set.
 java.lang.Object[] toArray(java.lang.Object[] array)
          Answers an array containing all elements contained in this Set.
 

Method Detail

add

boolean add(java.lang.Object object)
Adds the specified object to this Set. The Set is not modified if it already contains the object.

Specified by:
add in interface Collection
Parameters:
object - the object to add
Returns:
true if this Set is modified, false otherwise
Throws:
java.lang.UnsupportedOperationException - when adding to this Set is not supported
java.lang.ClassCastException - when the class of the object is inappropriate for this Set
java.lang.IllegalArgumentException - when the object cannot be added to this Set

addAll

boolean addAll(Collection collection)
Adds the objects in the specified Collection which do not exist in this Set.

Specified by:
addAll in interface Collection
Parameters:
collection - the Collection of objects
Returns:
true if this Set is modified, false otherwise
Throws:
java.lang.UnsupportedOperationException - when adding to this Set is not supported
java.lang.ClassCastException - when the class of an object is inappropriate for this Set
java.lang.IllegalArgumentException - when an object cannot be added to this Set

clear

void clear()
Removes all elements from this Set, leaving it empty.

Specified by:
clear in interface Collection
Throws:
java.lang.UnsupportedOperationException - when removing from this Set is not supported
See Also:
isEmpty(), size()

contains

boolean contains(java.lang.Object object)
Searches this Set for the specified object.

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

containsAll

boolean containsAll(Collection collection)
Searches this Set for all objects in the specified Collection.

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

equals

boolean equals(java.lang.Object object)
Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.

Specified by:
equals in interface Collection
Overrides:
equals in class java.lang.Object
Parameters:
object - Object the object to compare with this object.
Returns:
boolean true if the object is the same as this object false if it is different from this object.
See Also:
hashCode()

hashCode

int hashCode()
Answers an integer hash code for the receiver. Objects which are equal answer the same value for this method.

Specified by:
hashCode in interface Collection
Overrides:
hashCode in class java.lang.Object
Returns:
the receiver's hash
See Also:
equals(java.lang.Object)

isEmpty

boolean isEmpty()
Answers if this Set has no elements, a size of zero.

Specified by:
isEmpty in interface Collection
Returns:
true if this Set has no elements, false otherwise
See Also:
size()

iterator

Iterator iterator()
Answers an Iterator on the elements of this Set.

Specified by:
iterator in interface Collection
Specified by:
iterator in interface Iterable
Returns:
an Iterator on the elements of this Set
See Also:
Iterator

remove

boolean remove(java.lang.Object object)
Removes any occurrence of the specified object from this Set.

Specified by:
remove in interface Collection
Parameters:
object - the object to remove
Returns:
true if this Set is modified, false otherwise
Throws:
java.lang.UnsupportedOperationException - when removing from this Set is not supported

removeAll

boolean removeAll(Collection collection)
Removes all objects in the specified Collection from this Set.

Specified by:
removeAll in interface Collection
Parameters:
collection - the Collection of objects to remove
Returns:
true if this Set is modified, false otherwise
Throws:
java.lang.UnsupportedOperationException - when removing from this Set is not supported

retainAll

boolean retainAll(Collection collection)
Removes all objects from this Set that are not contained in the specified Collection.

Specified by:
retainAll in interface Collection
Parameters:
collection - the Collection of objects to retain
Returns:
true if this Set is modified, false otherwise
Throws:
java.lang.UnsupportedOperationException - when removing from this Set is not supported

size

int size()
Answers the number of elements in this Set.

Specified by:
size in interface Collection
Returns:
the number of elements in this Set

toArray

java.lang.Object[] toArray()
Answers an array containing all elements contained in this Set.

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

toArray

java.lang.Object[] toArray(java.lang.Object[] array)
Answers an array containing all elements contained in this Set. If the specified array is large enough to hold the elements, the specified array is used, otherwise an array of the same type is created. If the specified array is used and is larger than this Set, the array element following the collection elements is set to null.

Specified by:
toArray in interface Collection
Parameters:
array - the array
Returns:
an array of the elements from this Set
Throws:
java.lang.ArrayStoreException - when the type of an element in this Set cannot be stored in the type of the specified array

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client
11g Release 1 (11.1.1)

E17503-02

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.