Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Multivaluemap with keyset iterator returning in order

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Multivaluemap with keyset iterator returning in order

    im having a problem here

    i need to store a multiple values to a single key and i have to retrieve those values in same order i inserted

    in my case i used multivaluemap and while retieving i cant get the values in same order i inserted since keyset() is returning unordered set

    is there anyother solution please any one had a solution share it with me

    thanks in advance
    ..


  2. #2
    Junior Member
    Join Date
    Oct 2013
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Multivaluemap with keyset iterator returning in order

    Re: Multivaluemap with keyset iterator returning in order

    you can use list of objects against the key for value in map.
    List<YourDesiredClass> YourDesiredClassList = new ArrayList<YourDesiredClass>();
    YourDesiredClass obj1 = new YourDesiredClass();
    YourDesiredClassList.add(obj1);

    YourDesiredClass obj2 = new YourDesiredClass();
    YourDesiredClassList.add(obj2);


    Map<String,YourDesiredClass> YourDesiredClassMap = new HashMap<String,YourDesiredClass>();
    String listKey = "list";
    YourDesiredClassMap.put("list",YourDesiredClassLis t);

    Now work on it yourself.
    Please notify me if it helps you
    Best of luck

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Multivaluemap with keyset iterator returning in order

    See LinkedHashMap (Java Platform SE 7 )

Similar Threads

  1. Multivaluemap with keyset iterator returning in order
    By arunrsmit in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 26th, 2013, 11:23 AM
  2. Returning a list in a specified order
    By Fenrir in forum Java Theory & Questions
    Replies: 4
    Last Post: September 11th, 2013, 10:03 AM
  3. LinkedList Iterator
    By cpguy in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 16th, 2011, 09:51 PM
  4. stuck on Iterator
    By Mjall in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 29th, 2011, 11:00 PM
  5. iterator help needed
    By 999cm999 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 29th, 2011, 12:32 PM

Tags for this Thread