Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javafe.util
Class Set

    java.lang.Object
      javafe.util.Set

All Implemented Interfaces:
  java.lang.Cloneable

public class Set
extends java.lang.Object
implements java.lang.Cloneable

A simple implementation of imperative sets. Set's may not contain null.

Field Summary
`private java.util.Hashtable` | `ht` We contain the element e iff ht has the mapping e -> e.

Constructor Summary
`Set()` Create an empty set
`Set(java.util.Enumeration e)` Create a set from the elements of an Enumeration

Method Summary
`boolean` | `add(java.lang.Object o)` Add an element Return 'true' iff the element was already in the set.
`void` | `addEnumeration(java.util.Enumeration e)` Add all the elements of a given enumeration
`void` | `clear()` Remove all our elements
`java.lang.Object` | `clone()`
`boolean` | `contains(java.lang.Object o)` Do we contain a particular element?
`boolean` | `containsAny(Set s)` Returns whether or not the set has any element in common with `s`.
`java.util.Enumeration` | `elements()` Return an enumeration of our elements
`void` | `intersect(Set s)` Remove all elements not contained in another set.
`boolean` | `isEmpty()` Do we contain no elements?
`boolean` | `remove(java.lang.Object o)` Remove a particular element if we contain it.
`int` | `size()` Return the number of elements we hold.
`java.lang.String` | `toString()`
`boolean` | `union(Set s)` Adds all elements in another set.

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

Field Detail

### ht

    private java.util.Hashtable ht

  We contain the element e iff ht has the mapping e -> e.

  All mappings of ht are of the form e' -> e' for some e'.

Constructor Detail

### Set

    public Set()

  Create an empty set

### Set

    public Set(java.util.Enumeration e)

  Create a set from the elements of an Enumeration

Method Detail

### size

    public int size()

  Return the number of elements we hold.

### isEmpty

    public boolean isEmpty()

  Do we contain no elements?

### contains

    public boolean contains(java.lang.Object o)

  Do we contain a particular element?

### elements

    public java.util.Enumeration elements()

  Return an enumeration of our elements

### toString

    public java.lang.String toString()

### clear

    public void clear()

  Remove all our elements

### add

    public boolean add(java.lang.Object o)

  Add an element Return 'true' iff the element was already in the set.

### addEnumeration

    public void addEnumeration(java.util.Enumeration e)

  Add all the elements of a given enumeration

### remove

    public boolean remove(java.lang.Object o)

  Remove a particular element if we contain it. Return true iff the element was previously in the set.

### intersect

    public void intersect(Set s)

  Remove all elements not contained in another set. This has the effect of setting us to the intersection of our original value and the other set.

### union

    public boolean union(Set s)

  Adds all elements in another set. This has the effect of setting us to the union of our original value and the other set. Return true if any values were added.

### containsAny

    public boolean containsAny(Set s)

  Returns whether or not the set has any element in common with `s`. Thus, if the intersection of the sets is empty, that is, if the sets are disjoint, then `false` is returned. The operation leaves both sets unchanged.

### clone

    public java.lang.Object clone()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

The ESC/Java2 Project Homepage