Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.beasys.commerce.util
Class SoftHashMap

    java.lang.Object
      |
      +--java.util.AbstractMap
            |
            +--com.beasys.commerce.util.SoftHashMap

public class SoftHashMap
extends java.util.AbstractMap
implements java.util.Map, java.lang.Cloneable, java.io.Serializable

A map implemented using SoftReferences to store the values.

Unlike the `java.util.WeakHashMap` implementation, this does not utilize a ReferenceQueue, therefore, the References are cleared immediately, rather than only after a modification to the Map. Additionally, since this uses SoftReferences by default, the Map shouldn't be immediately cleared. Finally, this is also cloneable and serializable.

Since:
  2.0.1-sp1
See Also:
  Serialized Form

Constructor Summary
`SoftHashMap()` Deprecated. Constructs a new, empty `SoftHashMap` with the default capacity and the default load factor, which is `0.75`.
`SoftHashMap(int initialCapacity)` Deprecated. Constructs a new, empty `SoftHashMap` with the given initial capacity and the default load factor, which is `0.75`.
`SoftHashMap(int initialCapacity, float loadFactor)` Deprecated. Constructs a new, empty `SoftHashMap` with the given initial capacity and the given load factor.
`SoftHashMap(java.util.Map map)` Deprecated. Constructs a new `SoftHashMap` from the specified Map.

Method Summary
`void` | `clear()` Deprecated. Removes all mappings from this map.
`java.lang.Object` | `clone()` Deprecated. Return a shallow clone of this map.
`boolean` | `containsKey(java.lang.Object key)` Deprecated. Returns `true` if this map contains a mapping for the specified key.
`boolean` | `containsValue(java.lang.Object value)` Deprecated. Returns `true` if this map contains the specified value.
`protected java.lang.ref.Reference` | `createReference(java.lang.Object data)` Deprecated. Create a Reference object containing the specified object.
`java.util.Set` | `entrySet()` Deprecated. Returns a `Set` view of the mappings in this map.
`java.lang.Object` | `get(java.lang.Object key)` Deprecated. Returns the value to which this map maps the specified `key`.
`boolean` | `isEmpty()` Deprecated. Returns `true` if this map contains no key-value mappings.
`java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)` Deprecated. Updates this map so that the given `key` maps to the given `value`.
`java.lang.Object` | `remove(java.lang.Object key)` Deprecated. Removes the mapping for the given `key` from this map, if present.
`int` | `size()` Deprecated. Returns the number of key-value mappings in this map.

Methods inherited from class java.util.AbstractMap
`equals, hashCode, keySet, putAll, toString, values`

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

Constructor Detail

### SoftHashMap

    public SoftHashMap(int initialCapacity,
                       float loadFactor)

  Deprecated.
  Constructs a new, empty `SoftHashMap` with the given initial capacity and the given load factor.

  Parameters:
    `initialCapacity` - The initial capacity of the `SoftHashMap`
    `loadFactor` - The load factor of the `SoftHashMap`
  Throws:
    java.lang.IllegalArgumentException - If the initial capacity is less than zero, or if the load factor is nonpositive

### SoftHashMap

    public SoftHashMap(int initialCapacity)

  Deprecated.
  Constructs a new, empty `SoftHashMap` with the given initial capacity and the default load factor, which is `0.75`.

  Parameters:
    `initialCapacity` - The initial capacity of the `SoftHashMap`
  Throws:
    java.lang.IllegalArgumentException - If the initial capacity is less than zero

### SoftHashMap

    public SoftHashMap()

  Deprecated.
  Constructs a new, empty `SoftHashMap` with the default capacity and the default load factor, which is `0.75`.

### SoftHashMap

    public SoftHashMap(java.util.Map map)

  Deprecated.
  Constructs a new `SoftHashMap` from the specified Map.

Method Detail

### clone

    public java.lang.Object clone()

  Deprecated.
  Return a shallow clone of this map.

  Overrides:
    clone in class java.lang.Object

### createReference

    protected java.lang.ref.Reference createReference(java.lang.Object data)

  Deprecated.
  Create a Reference object containing the specified object.

  This implementation returns SoftReferences. Subclasses can override to return other Reference types.

  Parameters:
    `data` - the object (can be null).
  Returns:
    a Reference (can be null if data is null).

### size

    public int size()

  Deprecated.
  Returns the number of key-value mappings in this map. Note: In contrast with most implementations of the `Map` interface, the time required by this operation is linear in the size of the map.
  Specified by:
    size in interface java.util.Map

  Overrides:
    size in class java.util.AbstractMap

### isEmpty

    public boolean isEmpty()

  Deprecated.
  Returns `true` if this map contains no key-value mappings.
  Specified by:
    isEmpty in interface java.util.Map

  Overrides:
    isEmpty in class java.util.AbstractMap

### containsKey

    public boolean containsKey(java.lang.Object key)

  Deprecated.
  Returns `true` if this map contains a mapping for the specified key.
  Specified by:
    containsKey in interface java.util.Map

  Parameters:
    `key` - The key whose presence in this map is to be tested
  Overrides:
    containsKey in class java.util.AbstractMap

### containsValue

    public boolean containsValue(java.lang.Object value)

  Deprecated.
  Returns `true` if this map contains the specified value.
  Specified by:
    containsValue in interface java.util.Map

  Overrides:
    containsValue in class java.util.AbstractMap

### get

    public java.lang.Object get(java.lang.Object key)

  Deprecated.
  Returns the value to which this map maps the specified `key`. If this map does not contain a value for this key, then return `null`.
  Specified by:
    get in interface java.util.Map

  Parameters:
    `key` - The key whose associated value, if any, is to be returned
  Overrides:
    get in class java.util.AbstractMap

### put

    public java.lang.Object put(java.lang.Object key,
                                java.lang.Object value)

  Deprecated.
  Updates this map so that the given `key` maps to the given `value`. If the map previously contained a mapping for `key` then that mapping is replaced and the previous value is returned.
  Specified by:
    put in interface java.util.Map

  Parameters:
    `key` - The key that is to be mapped to the given `value`
    `value` - The value to which the given `key` is to be mapped
  Returns:
    The previous value to which this key was mapped, or `null` if if there was no mapping for the key
  Overrides:
    put in class java.util.AbstractMap

### remove

    public java.lang.Object remove(java.lang.Object key)

  Deprecated.
  Removes the mapping for the given `key` from this map, if present.
  Specified by:
    remove in interface java.util.Map

  Parameters:
    `key` - The key whose mapping is to be removed
  Returns:
    The value to which this key was mapped, or `null` if there was no mapping for the key
  Overrides:
    remove in class java.util.AbstractMap

### clear

    public void clear()

  Deprecated.
  Removes all mappings from this map.
  Specified by:
    clear in interface java.util.Map

  Overrides:
    clear in class java.util.AbstractMap

### entrySet

    public java.util.Set entrySet()

  Deprecated.
  Returns a `Set` view of the mappings in this map.
  Specified by:
    entrySet in interface java.util.Map

  Overrides:
    entrySet in class java.util.AbstractMap

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved