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

## com.pietschy.command.util
Class WeakSet<T>

    java.lang.Object
      com.pietschy.command.util.WeakSet<T>

All Implemented Interfaces:
  java.lang.Iterable<T>

    public class WeakSet<T>

extends java.lang.Object
implements java.lang.Iterable<T>

A utility class based on a `HashSet` that only keeps weak references to its objects.

This class does not implement `Set` and only provides access to its member via an iterator.

Field Summary
`(package private) com.pietschy.command.util.WeakSet.WeakIterator<T>` | `iterator`

Constructor Summary
`WeakSet()` Creats a new instance with the default size of 10.
`WeakSet(int size)` Creates a new instance with the initial size

Method Summary
`boolean` | `add(T o)` Add the specified object to the set.
`java.util.List<T>` | `asList()` Creates an returns a standard list containing all the objects in this set.
`boolean` | `contains(java.lang.Object o)` Checks if the set contains the specified object.
`boolean` | `isEmpty()` Checks if the set is empty.
`java.util.Iterator<T>` | `iterator()` Returns an interator over the objects in the set.
`boolean` | `remove(java.lang.Object o)` Removes the specified object from the set.
`void` | `removeAll()` Removes all the object from the set.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### iterator

    com.pietschy.command.util.WeakSet.WeakIterator<T> iterator

Constructor Detail

### WeakSet

    public WeakSet()

  Creats a new instance with the default size of 10.

### WeakSet

    public WeakSet(int size)

  Creates a new instance with the initial size

  Parameters:
    `size` - the initial size.

Method Detail

### isEmpty

    public boolean isEmpty()

  Checks if the set is empty.

  Returns:
    `true` if the set is empty, `false` otherwise.

### add

    public boolean add(T o)

  Add the specified object to the set. If the object already exists in the set, nothing is done.

  Parameters:
    `o` - the object to add.
  Returns:
    `true` if the object was added, `false` otherwise.

### remove

    public boolean remove(java.lang.Object o)

  Removes the specified object from the set.

  Parameters:
    `o` - the object to remove.
  Returns:
    `true` if the object was removed, `false` otherwise.

### removeAll

    public void removeAll()

  Removes all the object from the set.

### contains

    public boolean contains(java.lang.Object o)

  Checks if the set contains the specified object.

  Parameters:
    `o` - the object to check.
  Returns:
    `true` if the set contains the object, `false` otherwise.

### iterator

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

  Returns an interator over the objects in the set.

  Specified by:
    `iterator` in interface `java.lang.Iterable<T>`
  Returns:
    an interator over the objects in the set.

### asList

    public java.util.List<T> asList()

  Creates an returns a standard list containing all the objects in this set.

  Returns:
    a standard list containing all the objects in this set.

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

Copyright © 2006 - 2007 Andrew Pietsch