org.apache.mahout.cf.taste.impl.common
Class FastByIDMap<V>

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.common.FastByIDMap<V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public final class FastByIDMap<V>
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

See Also:
FastMap, FastIDSet, Serialized Form

Field Summary
static int NO_MAX_SIZE
           
 
Constructor Summary
FastByIDMap()
          Creates a new with default capacity.
FastByIDMap(int size)
           
FastByIDMap(int size, int maxSize)
          Creates a new whose capacity can accommodate the given number of entries without rehash.
 
Method Summary
 void clear()
           
 FastByIDMap<V> clone()
           
 boolean containsKey(long key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<java.lang.Long,V>> entrySet()
           
 V get(long key)
           
 boolean isEmpty()
           
 LongPrimitiveIterator keySetIterator()
           
 V put(long key, V value)
           
 void rehash()
           
 V remove(long key)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_MAX_SIZE

public static final int NO_MAX_SIZE
See Also:
Constant Field Values
Constructor Detail

FastByIDMap

public FastByIDMap()
Creates a new with default capacity.


FastByIDMap

public FastByIDMap(int size)

FastByIDMap

public FastByIDMap(int size,
                   int maxSize)
Creates a new whose capacity can accommodate the given number of entries without rehash.

Parameters:
size - desired capacity
maxSize - max capacity
Throws:
java.lang.IllegalArgumentException - if size is less than 0, maxSize is less than 1, or at least half of RandomUtils.MAX_INT_SMALLER_TWIN_PRIME
Method Detail

get

public V get(long key)

size

public int size()

isEmpty

public boolean isEmpty()

containsKey

public boolean containsKey(long key)

containsValue

public boolean containsValue(java.lang.Object value)

put

public V put(long key,
             V value)

remove

public V remove(long key)

clear

public void clear()

keySetIterator

public LongPrimitiveIterator keySetIterator()

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.Long,V>> entrySet()

rehash

public void rehash()

clone

public FastByIDMap<V> clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.