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

E17503-02

oracle.adfnmc.java.util
Interface Collection

All Superinterfaces:
Iterable
All Known Subinterfaces:
List, Queue, Set, SortedSet
All Known Implementing Classes:
AbstractCollection, AbstractList, AbstractSequentialList, AbstractSet, ArrayList, EntityRowSetImpl, HashSet, LinkedList, Stack, TreeSet, Vector, ViewCriteria, ViewCriteriaImpl

public interface Collection
extends Iterable

Collection is the root of the collection hierarchy.


Method Summary
 boolean add(java.lang.Object object)
          Attempts to add object to the contents of this Collection.
 boolean addAll(Collection collection)
          Attempts to add all of the objects contained in collection to the contents of this collection.
 void clear()
          Removes all elements from this Collection, leaving it empty.
 boolean contains(java.lang.Object object)
          Searches this Collection for the specified object.
 boolean containsAll(Collection collection)
          Searches this Collection 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 Collection has no elements, a size of zero.
 Iterator iterator()
          Returns an instance of Iterator that may be used to access the objects contained by this collection.
 boolean remove(java.lang.Object object)
          Removes the first occurrence of the specified object from this Collection.
 boolean removeAll(Collection collection)
          Removes all occurrences in this Collection of each object in the specified Collection.
 boolean retainAll(Collection collection)
          Removes all objects from this Collection that are not also found in the contents of collection.
 int size()
          Returns a count of how many objects are contained by this collection.
 java.lang.Object[] toArray()
          Answers a new array containing all elements contained in this Collection.
 java.lang.Object[] toArray(java.lang.Object[] array)
          Answers an array containing all elements contained in this Collection.
 

Method Detail

add

boolean add(java.lang.Object object)
Attempts to add object to the contents of this Collection.

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

addAll

boolean addAll(Collection collection)
Attempts to add all of the objects contained in collection to the contents of this collection.

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

clear

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

Throws:
java.lang.UnsupportedOperationException - when removing from this Collection is not supported
See Also:
isEmpty(), size()

contains

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

Parameters:
object - the object to search for
Returns:
true if object is an element of this Collection, false otherwise

containsAll

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

Parameters:
collection - the Collection of objects
Returns:
true if all objects in the specified Collection are elements of this Collection, 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.

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.

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

isEmpty

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

Returns:
true if this Collection has no elements, false otherwise
See Also:
size()

iterator

Iterator iterator()
Returns an instance of Iterator that may be used to access the objects contained by this collection.

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

remove

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

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

removeAll

boolean removeAll(Collection collection)
Removes all occurrences in this Collection of each object in the specified Collection.

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

retainAll

boolean retainAll(Collection collection)
Removes all objects from this Collection that are not also found in the contents of collection.

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

size

int size()
Returns a count of how many objects are contained by this collection.

Returns:
how many objects are contained by this collection

toArray

java.lang.Object[] toArray()
Answers a new array containing all elements contained in this Collection.

Returns:
an array of the elements from this Collection

toArray

java.lang.Object[] toArray(java.lang.Object[] array)
Answers an array containing all elements contained in this Collection. 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 Collection, the array element following the collection elements is set to null.

Parameters:
array - the array
Returns:
an array of the elements from this Collection
Throws:
java.lang.ArrayStoreException - when the type of an element in this Collection 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.