org.apache.myfaces.util
Class HashMapUtils
java.lang.Objectorg.apache.myfaces.util.HashMapUtils
public class HashMapUtils
extends java.lang.Object
$Revision: 167257 $ $Date: 2004-10-13 13:51:02 +0200 (Wed, 13 Oct 2004) $- Anton Koinov (latest modification by $Author: matze $)
static int | calcCapacity(int size)- Calculates initial capacity needed to hold
size elements in
a HashMap or Hashtable without forcing an expensive increase in internal
capacity.
|
static HashMap | merge(Map map1, Map map2)- Creates a new
HashMap that has all of the elements
of map1 and map2 (on key collision, the latter
override the former).
|
HashMapUtils
protected HashMapUtils()
calcCapacity
public static final int calcCapacity(int size)
Calculates initial capacity needed to hold
size elements in
a HashMap or Hashtable without forcing an expensive increase in internal
capacity. Capacity is based on the default load factor of .75.
Usage:
Map map = new HashMap(HashMapUtils.calcCapacity(10));
size - the number of items that will be put into a HashMap
merge
public static HashMap merge(Map map1,
Map map2) Creates a new HashMap that has all of the elements
of map1 and map2 (on key collision, the latter
override the former).
map1 - the fist hashmap to mergemap2 - the second hashmap to merge