Ejemplo n.º 1
0
 /** returns a dict of the things displaced by putting this */
 public Dict putAll(Dict d) {
   Dict r = new Dict();
   for (Map.Entry<Prop, Object> e : d.dictionary.entrySet()) {
     Object was = get(e.getKey());
     put(e.getKey(), e.getValue());
     if (was != null)
       r.put(e.getKey(), was instanceof Mutable ? ((Mutable) was).duplicate() : was);
   }
   return r;
 }
Ejemplo n.º 2
0
  public Dict duplicate() {
    Dict r = new Dict();

    r.dictionary = new LinkedHashMap<Prop, Object>(dictionary.size());
    for (Map.Entry<Prop, Object> e : dictionary.entrySet()) {
      r.dictionary.put(
          e.getKey(),
          e.getValue() instanceof Mutable ? ((Mutable) e.getValue()).duplicate() : e.getValue());
    }
    return r;
  }