TUM CCSM Commons

edu.tum.cs.commons.collections
Class MemoryEfficientStringMap<V>

java.lang.Object
  extended by edu.tum.cs.commons.collections.HybridMapBase<java.lang.String,V>
      extended by edu.tum.cs.commons.collections.MemoryEfficientStringMap<V>
All Implemented Interfaces:
java.util.Map<java.lang.String,V>

public class MemoryEfficientStringMap<V>
extends HybridMapBase<java.lang.String,V>

A map implementation of a map using string keys. This is based on a hybrid map which uses an ArrayBackedStringMap while only a small number of keys are present and switches to a HashMap after a certain size has been reached.

Version:
$Rev: 29399 $
Author:
hummelb, $Author: juergens $
Rating:
GREEN Hash: B82C7BCF35689181816346E57A25D854

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
MemoryEfficientStringMap()
          Constructor.
MemoryEfficientStringMap(java.util.Map<? extends java.lang.String,? extends V> map)
          Constructor.
 
Method Summary
protected  java.util.Map<java.lang.String,V> obtainNewMap()
          Template method for obtaining a new map implementation after HybridMapBase.shouldSwitch(Map) returned true.
protected  boolean shouldSwitch(java.util.Map<java.lang.String,V> map)
          Template method for deciding that a switch of map implementation should be performed before the next insertion.
 
Methods inherited from class edu.tum.cs.commons.collections.HybridMapBase
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MemoryEfficientStringMap

public MemoryEfficientStringMap()
Constructor.


MemoryEfficientStringMap

public MemoryEfficientStringMap(java.util.Map<? extends java.lang.String,? extends V> map)
Constructor.

Method Detail

obtainNewMap

protected java.util.Map<java.lang.String,V> obtainNewMap()
Template method for obtaining a new map implementation after HybridMapBase.shouldSwitch(Map) returned true.

Specified by:
obtainNewMap in class HybridMapBase<java.lang.String,V>

shouldSwitch

protected boolean shouldSwitch(java.util.Map<java.lang.String,V> map)
Template method for deciding that a switch of map implementation should be performed before the next insertion. This will be called right before each put operation. If this returns true, the new map implementation is obtained via HybridMapBase.obtainNewMap() and all values are copied.

Specified by:
shouldSwitch in class HybridMapBase<java.lang.String,V>
Parameters:
map - the currently used map.

TUM CCSM Commons

TUM CCSM Commons - 2.7