/** * Gets the collection mapped to the specified key. * This method is a convenience method to typecast the result of <code>get(key)</code>. * * @param key the key to retrieve * @return the collection mapped to the key, null if no mapping * @since Commons Collections 3.1 */ public Collection getCollection(Object key) { return (Collection) get(key); }
public void testGetCollection() { MultiHashMap map = new MultiHashMap(); map.put("A", "AA"); assertSame(map.get("A"), map.getCollection("A")); }
/** * Gets the collection mapped to the specified key. * This method is a convenience method to typecast the result of <code>get(key)</code>. * * @param key the key to retrieve * @return the collection mapped to the key, null if no mapping * @since Commons Collections 3.1 */ public Collection getCollection(Object key) { return (Collection) get(key); }
private void checkKeyList(MultiHashMap map, int index) { assertTrue(index < sMapPairs.length); Integer key = sMapPairs[index][0].mKey; Object obj = map.get(key); //-------------------------- assertTrue(obj != null); assertTrue(obj instanceof Collection); Collection keyList = (Collection) obj; assertTrue(keyList.size() == sMapPairs[index].length); Iterator iter = keyList.iterator(); while (iter.hasNext()) { Object oval = iter.next(); assertTrue(oval != null); assertTrue(oval instanceof String); String val = (String) oval; boolean foundIt = false; for (int ii = 0; ii < sMapPairs[index].length; ii++) { if (val.equals(sMapPairs[index][ii].mValue)) { foundIt = true; } } assertTrue(foundIt); } }
public void testConstructorCopy2() { Map map = new HashMap(); map.put("A", "1"); map.put("B", "2"); assertEquals(2, map.size()); MultiHashMap newMap = new MultiHashMap(map); Collection newColl = (Collection) newMap.get("A"); assertNotSame(map, newMap); assertEquals(2, map.size()); assertEquals(2, newMap.size()); assertEquals(1, newColl.size()); map.put("A", "3"); assertEquals(2, map.size()); assertEquals(2, newMap.size()); assertEquals(1, newColl.size()); map.put("C", "4"); assertEquals(3, map.size()); assertEquals(2, newMap.size()); assertEquals(1, newColl.size()); }
public void testPutNGet() { MultiHashMap map = new MultiHashMap(); loadMap(map); checkMap(map); assertTrue(map.get(new Integer(99)) == null); map.clear(); assertTrue(map.size() == 0); }
public void testConstructorCopy1() { MultiHashMap map = new MultiHashMap(); map.put("A", "1"); map.put("A", "2"); Collection coll = (Collection) map.get("A"); assertEquals(1, map.size()); assertEquals(2, coll.size()); MultiHashMap newMap = new MultiHashMap(map); Collection newColl = (Collection) newMap.get("A"); assertNotSame(map, newMap); assertNotSame(coll, newColl); assertEquals(1, map.size()); assertEquals(2, coll.size()); assertEquals(1, newMap.size()); assertEquals(2, newColl.size()); map.put("A", "3"); assertEquals(1, map.size()); assertEquals(3, coll.size()); assertEquals(1, newMap.size()); assertEquals(2, newColl.size()); }
public void testClone() { MultiHashMap map = new MultiHashMap(); map.put("A", "1"); map.put("A", "2"); Collection coll = (Collection) map.get("A"); assertEquals(1, map.size()); assertEquals(2, coll.size()); MultiHashMap cloned = (MultiHashMap) map.clone(); Collection clonedColl = (Collection) cloned.get("A"); assertNotSame(map, cloned); assertNotSame(coll, clonedColl); assertEquals(1, map.size()); assertEquals(2, coll.size()); assertEquals(1, cloned.size()); assertEquals(2, clonedColl.size()); map.put("A", "3"); assertEquals(1, map.size()); assertEquals(3, coll.size()); assertEquals(1, cloned.size()); assertEquals(2, clonedColl.size()); }
while(i.hasNext()) { Map.Entry me = (Map.Entry)i.next(); list=(List)mp.get(me.getKey());
Collection values = (Collection) map.get(property[0]);
/** * Gets the collection mapped to the specified key. * This method is a convenience method to typecast the result of <code>get(key)</code>. * * @param key the key to retrieve * @return the collection mapped to the key, null if no mapping * @since Commons Collections 3.1 */ public Collection getCollection(Object key) { return (Collection) get(key); }
/** * Gets the collection mapped to the specified key. * This method is a convenience method to typecast the result of <code>get(key)</code>. * * @param key the key to retrieve * @return the collection mapped to the key, null if no mapping * @since Commons Collections 3.1 */ public Collection getCollection(Object key) { return (Collection) get(key); }
/** * Gets the collection mapped to the specified key. * This method is a convenience method to typecast the result of <code>get(key)</code>. * * @param key the key to retrieve * @return the collection mapped to the key, null if no mapping * @since Commons Collections 3.1 */ public Collection getCollection(Object key) { return (Collection) get(key); }
/** * Gets the collection mapped to the specified key. * This method is a convenience method to typecast the result of <code>get(key)</code>. * * @param key the key to retrieve * @return the collection mapped to the key, null if no mapping * @since Commons Collections 3.1 */ public Collection getCollection(Object key) { return (Collection) get(key); }
/** * Gets the collection mapped to the specified key. * This method is a convenience method to typecast the result of <code>get(key)</code>. * * @param key the key to retrieve * @return the collection mapped to the key, null if no mapping * @since Commons Collections 3.1 */ public Collection getCollection(Object key) { return (Collection) get(key); }
public Object get( Object arg0 ) { return map.get( arg0 ); }
Collection values = (Collection) map.get( name ); if ( values.size() > 1 ) {
Collection values = (Collection) map.get(name);
Collection values = (Collection) map.get(name);