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: MultiHashMap - won't give the values back.

  1. #1
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default MultiHashMap - won't give the values back.

    I have this MultiHashMap:

    Map<String, String> map= new MultiHashMap();

    But now I can't seem to get the keys and values out of the HashMap.

    map.getKey();

    Then I get the error:
    The method getKey() is undefined for the type Map<String,String>

    So how do I get de values out of this HashMap then?


  2. #2
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: MultiHashMap - won't give the values back.

    I now made this for it:

            		for (String key : map.keySet()) {
            			for (String value : map.values()) {
            				if (Match.equals(key)) {
            					System.out.println(key + value);
            				}
            			}
            		}

    The only thing is, it returns all the values in the complete map.
    And I only want the values for a certain key.
    Last edited by Purple01; September 18th, 2012 at 02:56 AM.

  3. #3
    Member
    Join Date
    Sep 2012
    Location
    The Netherlands
    Posts
    84
    My Mood
    Inspired
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: MultiHashMap - won't give the values back.

    I changed the String, String to String, Object.
    Now it works.

Similar Threads

  1. Replies: 2
    Last Post: July 1st, 2012, 11:48 AM
  2. Give Me Some Project Ideas!
    By Emperor_Xyn in forum Java Theory & Questions
    Replies: 16
    Last Post: January 18th, 2012, 02:06 AM
  3. Replies: 2
    Last Post: July 7th, 2011, 03:46 PM
  4. Replies: 4
    Last Post: February 23rd, 2011, 08:20 AM
  5. New give thanks feature
    By JavaPF in forum The Cafe
    Replies: 0
    Last Post: April 11th, 2009, 11:14 AM