Package java.util

Examples of java.util.HashMap.clone()


            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


    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

    public synchronized void setCharSet(String key,
                                        String charset)
    {
        HashMap mapper = (HashMap) mappers[MAP_PROG];
        mapper = mapper != null ?
            (HashMap) mapper.clone() : new HashMap();
        mapper.put(key,charset);
        mappers[MAP_PROG] = mapper;
        mappers[MAP_CACHE].clear();
    }
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

    public synchronized void setCharSet(String key,
                                        String charset)
    {
        HashMap mapper = (HashMap) mappers[MAP_PROG];
        mapper = mapper != null ?
                (HashMap) mapper.clone() : new HashMap();
        mapper.put(key, charset);
        mappers[MAP_PROG] = mapper;
        mappers[MAP_CACHE].clear();
    }
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

      //addition or modification
      if (tempMap == null)
        tempMap = new HashMap(10);
      else
        //copy on write to protect against concurrent read
        tempMap = (HashMap) tempMap.clone();
      tempMap.put(path, description);
      linkDescriptions = tempMap;
    } else {
      //removal
      if (tempMap != null) {
View Full Code Here

        } else {
            Map resourcesBackup = new HashMap();
            for (Iterator it = resources.keySet().iterator(); it.hasNext();) {
                String resourceName = (String) it.next();
                HashMap resourceValue = (HashMap) resources.get(resourceName);
                resourcesBackup.put(resourceName, resourceValue.clone());
            }
            super.setZipFile(zfile);           
        }
    }
View Full Code Here

     * @param charset the corresponding charset.
     */
    public synchronized void setCharSet(String key, String charset) {
        HashMap mapper = (HashMap) mappers[MAP_PROG];

        mapper = (mapper != null) ? (HashMap) mapper.clone()
                                  : new HashMap();
        mapper.put(key, charset);
        mappers[MAP_PROG] = mapper;
        mappers[MAP_CACHE].clear();
    }
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.