hashmap

how to extract values from one hash map and put it in to another hash map
[80 byte] By [RaviKumar.Avulaa] at [2007-11-27 9:06:49]
# 1

1) Obtain object from first HashMap

2) (optional) Remove said object from first HashMap (depends on your requirements)

3) Insert said object into second HashMap

If you can't work it out from that, give up. If you couldn't work it out without the above, you may well be in over your head and perhaps need to re-visit a tutorial or 2

georgemca at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...
# 2
anotherHashMap.putAll(oneHashMap); http://java.sun.com/j2se/1.5.0/docs/api/java/util/HashMap.html
OleVVa at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...
# 3
Map map1 = new HashMap();map1.put("Key1:,"value1);Map map2 = new HashMap();map2.put("key2", map1.get("key1"));:) hope this help u
KumarAruna at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...
# 4
> Map map1 = new HashMap();> > map1.put("Key1:,"value1);> > Map map2 = new HashMap();> > map2.put("key2", map1.get("key1"));> > :) hope this help uInteresting way to store null for "key2" in map2.
stefan.schulza at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...
# 5

> > Map map1 = new HashMap();

> >

> > map1.put("Key1:,"value1);

> >

> > Map map2 = new HashMap();

> >

> > map2.put("key2", map1.get("key1"));

> >

> > :) hope this help u

>

> Interesting way to store null for "key2" in map2.

Would be if the thing would compile :-)

Take a closer look at line 2

georgemca at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...
# 6

> > > Map map1 = new HashMap();

> > >

> > > map1.put("Key1:,"value1);

> > >

> > > Map map2 = new HashMap();

> > >

> > > map2.put("key2", map1.get("key1"));

> > >

> > > :) hope this help u

> >

> > Interesting way to store null for "key2" in map2.

>

> Would be if the thing would compile :-)

>

> Take a closer look at line 2

Oh, cruel trick.

stefan.schulza at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...
# 7

Well, take out the typos, and I read that you get value1 (with or without quotes) for "key2" in map2. Probably not what the OP wanted, but not in strict contradiction with what he or she asked for.

Teasing aside, RaviKumar.Avula, I'm curious to know whether you find that your question has been answered?

OleVVa at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...
# 8
correction in following line map1.put("Key1",value1);bitte
KumarAruna at 2007-7-12 21:42:45 > top of Java-index,Core,Core APIs...