Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7179167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:05:09+00:00 2026-05-28T17:05:09+00:00

I have for instance this Map: Map<String, Integer> map = new HashMap<String,Integer>(); than I

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:05:10+00:00Added an answer on May 28, 2026 at 5:05 pm

    You are mixing two questions together. Don’t know which you are asking:

    1. Can you transport a hierarchical map thro ObjectOutputStream?
    2. How to map a map to a map?

    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:

    Map<String, Map<?,?>> mapOfMap = new HashMap<String, Map<?,?>>();
    
    Map<String, Integer> mapA = new HashMap<String, Integer>();
    
    mapOfMap.put("a", mapA);
    

    Answer to question 1:

    Of course.

    …

    To answer your further questions:

    Set of all the keys and its iterator,

    Set<String> keys = mapOfMap.keySet();
    Iterator<String> iterator = keys.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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a class with a string instance attribute. Should I initialize this
I have a property @JsonProperty private Map<String, String> parameters = new HashMap<String, String>(); When
For instance I have a string like this : abc123[*]xyz[#]098[~]f9e [*] , [#] and
When you have an object instance in C#, you can use the this keyword
I have this object which is an instance of a superclass. I want to
I have this string : <meis xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance uri=localhost/naro-nei onded=flpSW531213 identi=lemenia id=75 lastStop=bendi xsi:noNamespaceSchemaLocation=http://localhost/xsd/postat.xsd xsd/postat.xsd>
Okay, I have this program and I don't want more than one instance of
I have a map like this: private Map<String, List<List<String>>> someMap; private List<List<String>> someList1; private
Lets say I have this class class Child { public string FirstName { get;
I have the following function: appendMsg :: String -> (String, Integer) -> Map.Map (String,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.