How to create a collection of hashMap

I have a query which returns a collection through ORM.

Now I parse that collection and do so processign based upon a particular value of key null and not null

and I have to create two separate collections out of this main collection.

How do I do that?

Collection will contain Maps.

Collection c1=new HashMap();

c1.add(m1);//m1 is a map containing a pair of keys and vlaues

This above code doesnt work?

Pls help

[466 byte] By [Rhea1978a] at [2007-11-27 11:26:58]
# 1

HashMap isn't a Collection (see other thread near this one)

georgemca at 2007-7-29 16:13:35 > top of Java-index,Core,Core APIs...
# 2

Ok so how shall I proceed for this particular scenario

I have a collection which i got from a query and now I want to create two collections out of it

and in my JSP I am accessign the values of the collection with ${map.field1}

Please guide

Rhea1978a at 2007-7-29 16:13:35 > top of Java-index,Core,Core APIs...
# 3

Why dont you use Vectors or ArrayList ?

List coll1 = new Vector();

coll1.add(obj);

List coll2 = new Vector();

coll2.add(obj);

If you want to use ArrayList just replace new Vector() with new ArrayList();

Both Vector and ArrayList serve the same purpose, except for the difference that Vector is synchronized and ArrayList is not synchronized...

saracgia at 2007-7-29 16:13:35 > top of Java-index,Core,Core APIs...