Overview | Package | Class | Tree | Deprecated | Index | Help
| 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

## oracle.jbo.server.java.util
Class ArraySet

`java.lang.Object
oracle.jbo.server.java.util.AbstractCollection
oracle.jbo.server.java.util.AbstractSet
oracle.jbo.server.java.util.ArraySet`

All Implemented Interfaces:
  java.lang.Cloneable, Collection, java.io.Serializable, Set

public class ArraySet
extends AbstractSet
implements Set, java.lang.Cloneable, java.io.Serializable

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.

Since:
  JDK1.2
See Also:
  `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

### ArraySet

    public ArraySet()

  Constructs a new, empty ArraySet; the backing ArrayList has default initial capacity and capacity increment.
Since:
  JDK1.2

### ArraySet

    public ArraySet(Collection c)

  Constructs a new ArraySet containing the elements in the specified Collection. The backing ArrayList has default initial capacity and capacity increment.
Throws:
  `java.lang.NullPointerException` - the specified collection is null.
Since:
  JDK1.2

### ArraySet

    public ArraySet(int initialCapacity)

  Constructs a new, empty ArraySet; the backing ArrayList has the specified initial capacity and default capacity increment.
Parameters:
  `initialCapacity` - the initial capacity of the ArrayList.
Since:
  JDK1.2

Method Detail

### iterator

    public Iterator iterator()

  Returns an Iterator over the elements in this ArraySet. The elements are returned in the order they were added.
  Specified by:
    `iterator` in interface `Set`
  Specified by:
    `iterator` in class `AbstractCollection`
  Since:
    JDK1.2

### size

    public int size()

  Returns the number of elements in this ArraySet (its cardinality).
  Specified by:
    `size` in interface `Set`
  Specified by:
    `size` in class `AbstractCollection`
  Since:
    JDK1.2

### isEmpty

    public boolean isEmpty()

  Returns true if this ArraySet contains no elements.
  Specified by:
    `isEmpty` in interface `Set`
  Overrides:
    `isEmpty` in class `AbstractCollection`
  Since:
    JDK1.2

### contains

    public boolean contains(java.lang.Object o)

  Returns true if this ArraySet contains the specified element.
  Specified by:
    `contains` in interface `Set`
  Overrides:
    `contains` in class `AbstractCollection`
  Since:
    JDK1.2

### add

    public boolean add(java.lang.Object o)

  Adds the specified element to this Set if it is not already present.
  Specified by:
    `add` in interface `Set`
  Overrides:
    `add` in class `AbstractCollection`
  Parameters:
    `o` - element to be added to this Set.
  Returns:
    true if the Set did not already contain the specified element.
  Since:
    JDK1.2

### remove

    public boolean remove(java.lang.Object o)

  Removes the given element from this Set if it is present.
  Specified by:
    `remove` in interface `Set`
  Overrides:
    `remove` in class `AbstractCollection`
  Parameters:
    `o` - object to be removed from this Set, if present.
  Returns:
    true if the Set contained the specified element.
  Since:
    JDK1.2

### clear

    public void clear()

  Removes all of the elements from this Set.
  Specified by:
    `clear` in interface `Set`
  Overrides:
    `clear` in class `AbstractCollection`
  Since:
    JDK1.2

### clone

    public java.lang.Object clone()

  Returns a shallow copy of this ArraySet. (The elements themselves are not cloned.)
  Since:
    JDK1.2

Overview | Package | Class | Tree | Deprecated | Index | Help
| 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

Copyright © 1997, 2005, Oracle. All rights reserved.