Code example for WeakHashMap

0
 
  private Map<SNode, _FunctionTypes._void_P0_E0> allActions;
 
 
  private ClosureHoldingNodeUtil() { 
    allActions = new WeakHashMap<SNode, _FunctionTypes._void_P0_E0>();
  } 
 
 
 
  public static ClosureHoldingNodeUtil getInstance() { 
    if (myInstance == null) {
      myInstance = new ClosureHoldingNodeUtil();
    } 
    return myInstance;
  } 
 
 
 
  public void register(SNode node, _FunctionTypes._void_P0_E0 closure) {
    MapSequence.fromMap(allActions).put(node, closure);