I have for instance this Map:
Map<String, Integer> map = new HashMap<String,Integer>();
than I put some values:
map.put("a", 2);
map.put("b", 3);
Than I have this class to serialize this object:
public class MapObject implements Serializable {
private static final long serialVersionUID = 1L;
Map<String, Integer> map = new HashMap<String, Integer>();
public MapObject(Map<String, Integer> map) {
this.map = map;
}
}
I do this because I’m working with sockets and I want to pass a map object from the client to the server using ObjectInputStream and ObjectOutputStream.
Now what I want to ask is if I can store this Map object in the server, for instance
MapObject mo;
Is it possible to store this object in another Map?
Regards
You are mixing two questions together. Don’t know which you are asking:
If you are asking question 2, you should not mention even mention question 1 because it confuses the question. OR are you asking both questions?
Answer to question 2:
Answer to question 1:
Of course.
…
To answer your further questions:
Set of all the keys and its iterator,
Look at http://code.google.com/p/synthfuljava/source/browse/trunk/common/org/synthful/util/HashTreeNode.java,
to see an example of what can be done with map of maps.
That tree hash node was written (poorly) in 2004 (and needs to have fluff like toStringBuffer removed), but it does adequately to illustrate an xpath addressable hash tree. I have another version for GWT with the fluff removed somewhere else.