## org.apache.mahout.math.set
Class AbstractDoubleSet

    java.lang.Object
      org.apache.mahout.math.PersistentObject
          org.apache.mahout.math.set.AbstractSet
              org.apache.mahout.math.set.AbstractDoubleSet

All Implemented Interfaces:
  Serializable, Cloneable

Direct Known Subclasses:
  OpenDoubleHashSet

    public abstract class AbstractDoubleSet

extends AbstractSet

See Also:
  Serialized Form

Field Summary

Fields inherited from class org.apache.mahout.math.set.AbstractSet
`DEFAULT_CAPACITY, DEFAULT_MAX_LOAD_FACTOR, DEFAULT_MIN_LOAD_FACTOR, distinct, highWaterMark, lowWaterMark, maxLoadFactor, minLoadFactor`

Constructor Summary
`AbstractDoubleSet()`

Method Summary
`abstract boolean` `add(double key)` Associates the given key with the given value.
`boolean` `contains(double key)` Returns `true` if the receiver contains the specified key.
`AbstractDoubleSet` `copy()` Returns a deep copy of the receiver; uses `clone()` and casts the result.
`boolean` `equals(Object obj)`
`abstract boolean` `forEachKey(DoubleProcedure procedure)` Applies a procedure to each key of the receiver, if any.
`int` `hashCode()`
`DoubleArrayList` `keys()` Returns a list filled with all keys contained in the receiver.
`void` `keys(DoubleArrayList list)` Fills all keys contained in the receiver into the specified list.
`abstract boolean` `remove(double key)` Removes the given key with its associated element from the receiver, if present.
`String` `toString()` Returns a string representation of the receiver, containing the String representation of each key-value pair, sorted ascending by key.

Methods inherited from class org.apache.mahout.math.set.AbstractSet
`chooseGrowCapacity, chooseHighWaterMark, chooseLowWaterMark, chooseMeanCapacity, chooseShrinkCapacity, clear, ensureCapacity, equalsMindTheNull, isEmpty, nextPrime, setUp, size, trimToSize`

Methods inherited from class org.apache.mahout.math.PersistentObject
`clone`

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

Constructor Detail

### AbstractDoubleSet

    public AbstractDoubleSet()

Method Detail

### contains

    public boolean contains(double key)

  Returns `true` if the receiver contains the specified key.

  Returns:
    `true` if the receiver contains the specified key.

### copy

    public AbstractDoubleSet copy()

  Returns a deep copy of the receiver; uses `clone()` and casts the result.

  Returns:
    a deep copy of the receiver.

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### forEachKey

    public abstract boolean forEachKey(DoubleProcedure procedure)

  Applies a procedure to each key of the receiver, if any. Note: Iterates over the keys in no particular order. Subclasses can define a particular order, for example, "sorted by key". All methods which can be expressed in terms of this method (most methods can) must guarantee to use the same order defined by this method, even if it is no particular order. This is necessary so that, for example, methods `keys` and `values` will yield association pairs, not two uncorrelated lists.

  Parameters:
    `procedure` - the procedure to be applied. Stops iteration if the procedure returns `false`, otherwise continues.
  Returns:
    `false` if the procedure stopped before all keys where iterated over, `true` otherwise.

### keys

    public DoubleArrayList keys()

  Returns a list filled with all keys contained in the receiver. The returned list has a size that equals `this.size()`. Iteration order is guaranteed to be identical to the order used by method `forEachKey(DoubleProcedure)`.

  This method can be used to iterate over the keys of the receiver.

  Returns:
    the keys.

### keys

    public void keys(DoubleArrayList list)

  Fills all keys contained in the receiver into the specified list. Fills the list, starting at index 0. After this call returns the specified list has a new size that equals `this.size()`. Iteration order is guaranteed to be identical to the order used by method `forEachKey(DoubleProcedure)`.

  This method can be used to iterate over the keys of the receiver.

  Parameters:
    `list` - the list to be filled, can have any size.

### add

    public abstract boolean add(double key)

  Associates the given key with the given value. Replaces any old `(key,someOtherValue)` association, if existing.

  Parameters:
    `key` - the key the value shall be associated with.
  Returns:
    `true` if the receiver did not already contain such a key; `false` if the receiver did already contain such a key - the new value has now replaced the formerly associated value.

### remove

    public abstract boolean remove(double key)

  Removes the given key with its associated element from the receiver, if present.

  Parameters:
    `key` - the key to be removed from the receiver.
  Returns:
    `true` if the receiver contained the specified key, `false` otherwise.

### toString

    public String toString()

  Returns a string representation of the receiver, containing the String representation of each key-value pair, sorted ascending by key.

  Overrides:
    `toString` in class `Object`

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.