Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## toxi.util.datatypes
Class ArraySet<E>

    java.lang.Object
      java.util.AbstractCollection<E>
          java.util.AbstractSet<E>
              toxi.util.datatypes.ArraySet<E>

All Implemented Interfaces:
  java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

    public class ArraySet<E>

extends java.util.AbstractSet<E>

An ArrayList implementation of Set. An ArraySet is good for small sets; it has less overhead than a HashSet or a TreeSet.

Constructor Summary
`ArraySet()` Create an empty set (default initial capacity is 3).
`ArraySet(java.util.Collection<? extends E> collection)` Create a set containing the items of the collection.
`ArraySet(int initialCapacity)` Create an empty set with the specified initial capacity.

Method Summary
`boolean` | `add(E item)`
`boolean` | `containsAny(java.util.Collection<?> collection)` True if any member of the collection is also in the ArraySet.
`E` | `get(int index)` Get the item at the specified index.
`java.util.Iterator<E>` | `iterator()`
`int` | `size()`

Methods inherited from class java.util.AbstractSet
`equals, hashCode, removeAll`

Methods inherited from class java.util.AbstractCollection
`addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Set
`addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray`

Constructor Detail

### ArraySet

    public ArraySet()

  Create an empty set (default initial capacity is 3).

### ArraySet

    public ArraySet(java.util.Collection<? extends E> collection)

  Create a set containing the items of the collection. Any duplicate items are discarded.

  Parameters:
    `collection` - the source for the items of the small set

### ArraySet

    public ArraySet(int initialCapacity)

  Create an empty set with the specified initial capacity.

  Parameters:
    `initialCapacity` - the initial capacity

Method Detail

### add

    public boolean add(E item)

  Specified by:
    `add` in interface `java.util.Collection<E>`
  Specified by:
    `add` in interface `java.util.Set<E>`
  Overrides:
    `add` in class `java.util.AbstractCollection<E>`

### containsAny

    public boolean containsAny(java.util.Collection<?> collection)

  True if any member of the collection is also in the ArraySet.

  Parameters:
    `collection` - the Collection to check
  Returns:
    true if any member of collection appears in this ArraySet

### get

    public E get(int index)
          throws java.lang.IndexOutOfBoundsException

  Get the item at the specified index.

  Parameters:
    `index` - where the item is located in the ListSet
  Returns:
    the item at the specified index
  Throws:
    `java.lang.IndexOutOfBoundsException` - if the index is out of bounds

### iterator

    public java.util.Iterator<E> iterator()

  Specified by:
    `iterator` in interface `java.lang.Iterable<E>`
  Specified by:
    `iterator` in interface `java.util.Collection<E>`
  Specified by:
    `iterator` in interface `java.util.Set<E>`
  Specified by:
    `iterator` in class `java.util.AbstractCollection<E>`

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Collection<E>`
  Specified by:
    `size` in interface `java.util.Set<E>`
  Specified by:
    `size` in class `java.util.AbstractCollection<E>`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD