jfun.util.dict
Class DictFactory

java.lang.Object
  extended byjfun.util.dict.DictFactory

public class DictFactory
extends java.lang.Object

The factory to create Dict objects.

Author:
Ben Yu Jan 16, 2005

Constructor Summary
DictFactory()
           
 
Method Summary
static Dict instance()
          returns an empty instance of unsafe immutable dictionary.
static Dict merge(Dict d1, Dict d2)
          Add the contents in the second Dict object into the first.
static Dict safeInstance()
          same as instance() except this is a thread-safe version
static Dict subtract(Dict d1, Dict d2)
          Remove the elements contained in the second Dict object from the first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictFactory

public DictFactory()
Method Detail

instance

public static Dict instance()
returns an empty instance of unsafe immutable dictionary.


safeInstance

public static Dict safeInstance()
same as instance() except this is a thread-safe version


merge

public static Dict merge(Dict d1,
                         Dict d2)
Add the contents in the second Dict object into the first. elements with the same key are overwritten.

Parameters:
d1 - the first Dict object.
d2 - the second Dict object.
Returns:
the new Dict object.

subtract

public static Dict subtract(Dict d1,
                            Dict d2)
Remove the elements contained in the second Dict object from the first.

Parameters:
d1 - the first Dict object.
d2 - the second Dict object.
Returns:
the new Dict object.