Package java.util

Examples of java.util.HashMap.clone()


    public void setCapacity(String name,
                            int capacity)
    {
        HashMap repository = poolRepository;
        repository = repository != null ?
            (HashMap) repository.clone() : new HashMap();
        repository.put(name,new PoolBuffer(capacity));
        poolRepository = repository;
    }

    /**
 
View Full Code Here


                {
                    throw new TurbineException(
                        "Incorrect factory " + (String) factory +
                            " for class " + className,x);
                }
                factories = (HashMap) factories.clone();
                factories.put(className,factory);
                objectFactories = factories;
            }
            return (Factory) factory;
        }
View Full Code Here

    MyMap map = new MyMap();
    map.put("one", "1");
    Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
    assertTrue("entry not added", entry.getKey() == "one"
        && entry.getValue() == "1");
    MyMap mapClone = (MyMap) map.clone();
    assertTrue("clone not shallow", map.getMap() == mapClone.getMap());
  }
 
  public class AMT extends AbstractMap {
View Full Code Here

    Collection values = map.values();
    assertEquals("values() does not work",
        "value", values.iterator().next());
    assertEquals("keySet() does not work",
        "key", keys.iterator().next());
    AbstractMap map2 = (AbstractMap) map.clone();
    map2.put("key", "value2");
    Collection values2 = map2.values();
    assertTrue("values() is identical", values2 != values);
    // values() and keySet() on the cloned() map should be different
    assertEquals("values() was not cloned",
View Full Code Here

    final Iterator entries = namespaces.entrySet().iterator();
    while (entries.hasNext())
    {
      final Map.Entry entry = (Map.Entry) entries.next();
      final HashMap value = (HashMap) entry.getValue();
      entry.setValue(value.clone());
    }
  }

  /**
   * Creates a copy of this map.
View Full Code Here

        final Iterator entries = map.namespaces.entrySet().iterator();
        while (entries.hasNext())
        {
          final Map.Entry entry = (Map.Entry) entries.next();
          final HashMap value = (HashMap) entry.getValue();
          entry.setValue(value.clone());
        }
      }
      return map;
    }
    catch (final CloneNotSupportedException cne)
View Full Code Here

    final Iterator entries = namespaces.entrySet().iterator();
    while (entries.hasNext())
    {
      final Map.Entry entry = (Map.Entry) entries.next();
      final HashMap value = (HashMap) entry.getValue();
      entry.setValue(value.clone());
    }
  }

  public AttributeMap createUnmodifiableMap()
  {
View Full Code Here

    final Iterator entries = map.namespaces.entrySet().iterator();
    while (entries.hasNext())
    {
      final Map.Entry entry = (Map.Entry) entries.next();
      final HashMap value = (HashMap) entry.getValue();
      entry.setValue(value.clone());
    }
    return map;
  }

View Full Code Here

    MyMap map = new MyMap();
    map.put("one", "1");
    Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
    assertTrue("entry not added", entry.getKey() == "one"
        && entry.getValue() == "1");
    MyMap mapClone = (MyMap) map.clone();
    assertTrue("clone not shallow", map.getMap() == mapClone.getMap());
  }
 
  public class AMT extends AbstractMap {
View Full Code Here

            String name = instance.getIntakeGroupName();
            PoolBuffer pool = (PoolBuffer) repository.get(name);
            if (pool == null)
            {
                pool = new PoolBuffer(instance.getPoolCapacity());
                repository = (HashMap) repository.clone();
                repository.put(name,pool);
                poolRepository = repository;
            }
            return pool.offer(instance);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.