av.util
Class SoftHashLongMap<T>
java.lang.Object
av.util.SoftHashLongMap<T>
- All Implemented Interfaces:
- LongMap<T>, Iterable<T>
public class SoftHashLongMap<T>
- extends Object
- implements LongMap<T>, Iterable<T>
A simple hash implementation of the LongMap interface.
This map stores values via SoftReference, so won't
prevent the objects inside from being garbage collected.
- Author:
- Compl
|
Constructor Summary |
SoftHashLongMap(int slotSizePower)
The slot size are regulated from 8 to 4M, with the integral power of 2
specified by slotSizePower. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
slotSize
public final int slotSize
SoftHashLongMap
public SoftHashLongMap(int slotSizePower)
- The slot size are regulated from 8 to 4M, with the integral power of 2
specified by
slotSizePower.
- Parameters:
slotSizePower - Power of 2 used to set the size of the slots, if out of range
3 - 22, adjusted to the nearest number.
createEntry
protected SoftHashLongMap.Entry<T> createEntry(long id,
T value)
getSlotSize
public int getSlotSize()
getEntry
protected SoftHashLongMap.Entry<T> getEntry(long id)
get
public T get(long id)
- Specified by:
get in interface LongMap<T>
- Returns:
- the value at id
remove
public T remove(long id)
- Specified by:
remove in interface LongMap<T>
- Returns:
- the old value at id
put
public void put(long id,
T obj)
- Specified by:
put in interface LongMap<T>
clear
public void clear()
- Description copied from interface:
LongMap
- clear the map
- Specified by:
clear in interface LongMap<T>
iterator
public Iterator<T> iterator()
- Specified by:
iterator in interface Iterable<T>
Copyright© 2006 Ableverse Platform. All rights reserved.