harpoon.Util
Class ArraySet<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by harpoon.Util.ArraySet<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>

public class ArraySet<E>
extends AbstractSet<E>

ArraySet creates an unmodifiable Set view of an array. The idea is similar to java.util.Arrays.asList().

Version:
$Id: ArraySet.java,v 1.3 2002/04/10 03:07:03 cananian Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Constructor Summary
ArraySet(E[] oa)
          Creates a ArraySet from an object array.
 
Method Summary
 Iterator<E> iterator()
           
 int size()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray
 

Constructor Detail

ArraySet

public ArraySet(E[] oa)
Creates a ArraySet from an object array. All objects must be unique.

Method Detail

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>
Specified by:
iterator in class AbstractCollection<E>

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>
Specified by:
size in class AbstractCollection<E>