|
Oracle Application Development Framework Model and Business Components Java API Reference
10g Release 3 (10.1.3) B16005-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
oracle.jbo.server.java.util.AbstractCollection
oracle.jbo.server.java.util.AbstractSet
oracle.jbo.server.java.util.ArraySet
This class implements the Set interface, backed by an ArrayList. It is designed to offer good performance for very small Sets, especially those that are frequently created and destroyed. The performance will be extremely bad for large Sets: ArraySet provides linear time performance for the basic operations (add, remove and contains). This Set permit all elements, including null.
Note that this implementation is not synchronized. If multiple threads access an ArraySet concurrently, and at least one of the threads modifies the ArraySet, it must be synchronized externally. This is typically accomplished by synchronizing on some object that naturally encapsulates the ArraySet. If no such object exists, the ArraySet should be "wrapped" using the Collections.synchronizedSet method. This is best done at creation time, to prevent accidental unsynchronized access to the ArraySet:
Set s = Collections.synchronizedSet(new ArraySet(...));
The Iterators returned by ArraySet's iterator method are fail-fast: if the HashSet is modified at any time after the Iterator is created, in any way except through the Iterator's own remove method, the Iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the Iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
Collection, Set, HashSet, Collections.SynchronizedSet, ArrayList, Serialized Form| Constructor Summary | |
ArraySet()Constructs a new, empty ArraySet; the backing ArrayList has default initial capacity and capacity increment. |
|
ArraySet(Collection c)Constructs a new ArraySet containing the elements in the specified Collection. |
|
ArraySet(int initialCapacity)Constructs a new, empty ArraySet; the backing ArrayList has the specified initial capacity and default capacity increment. |
|
| Method Summary | |
boolean |
add(java.lang.Object o)Adds the specified element to this Set if it is not already present. |
void |
clear()Removes all of the elements from this Set. |
java.lang.Object |
clone()Returns a shallow copy of this ArraySet. |
boolean |
contains(java.lang.Object o)Returns true if this ArraySet contains the specified element. |
boolean |
isEmpty()Returns true if this ArraySet contains no elements. |
Iterator |
iterator()Returns an Iterator over the elements in this ArraySet. |
boolean |
remove(java.lang.Object o)Removes the given element from this Set if it is present. |
int |
size()Returns the number of elements in this ArraySet (its cardinality). |
| Methods inherited from class oracle.jbo.server.java.util.AbstractSet |
equals, hashCode |
| Methods inherited from class oracle.jbo.server.java.util.AbstractCollection |
addAll, containsAll, removeAll, retainAll, toArray, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface oracle.jbo.server.java.util.Set |
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray |
| Constructor Detail |
public ArraySet()
public ArraySet(Collection c)
java.lang.NullPointerException - the specified collection is null.public ArraySet(int initialCapacity)
initialCapacity - the initial capacity of the ArrayList.| Method Detail |
public Iterator iterator()
iterator in interface Setiterator in class AbstractCollectionpublic int size()
size in interface Setsize in class AbstractCollectionpublic boolean isEmpty()
isEmpty in interface SetisEmpty in class AbstractCollectionpublic boolean contains(java.lang.Object o)
contains in interface Setcontains in class AbstractCollectionpublic boolean add(java.lang.Object o)
add in interface Setadd in class AbstractCollectiono - element to be added to this Set.public boolean remove(java.lang.Object o)
remove in interface Setremove in class AbstractCollectiono - object to be removed from this Set, if present.public void clear()
clear in interface Setclear in class AbstractCollectionpublic java.lang.Object clone()
|
Oracle Application Development Framework Model and Business Components Java API Reference
10g Release 3 (10.1.3) B16005-01 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||