Results 1 to 3 of 3
  1. #1
    nat
    nat is offline Member
    Join Date
    Dec 2013
    Posts
    56
    Rep Power
    0

    Default Problem with Map<K,V>

    Hi,

    I have a for loop

    for(BufferedImage lineImage : lineImageMap.keySet()) {
    where lineImageMap is of type Map<BufferedImage, Section>. Every BufferedImage has its own SectionID

    Within the for loop I want to use the value of the Section but I don't know how.
    I tried with another nested for loop as

    for ( Section section:lineImageMap.values())
    I get the correct values for Section id, but they do not correspond to the calculations I have for the lineImage key value.

    Can anybody help me please how to use the corresponding SectionID for the appropriate lineImage in the same for loop?

    Thanks

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,783
    Rep Power
    5

    Default Re: Problem with Map<K,V>

    Java Code:
    for(BufferedImage lineImage : lineImageMap.keySet()) {
        Section section = lineImageMap.get(lineImage);
        // do something with section.
    }
    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    nat
    nat is offline Member
    Join Date
    Dec 2013
    Posts
    56
    Rep Power
    0

Similar Threads

  1. Problem with a Simple Histogram Problem
    By kathmandu in forum New To Java
    Replies: 12
    Last Post: 06-25-2013, 01:19 AM
  2. Replies: 0
    Last Post: 11-07-2012, 12:44 PM
  3. Small problem with problem with Java, C++ parse program.
    By dragstang86 in forum New To Java
    Replies: 4
    Last Post: 10-30-2011, 03:43 AM
  4. Replies: 9
    Last Post: 09-21-2010, 04:15 PM
  5. simple line problem / for loop problem
    By helpisontheway in forum New To Java
    Replies: 1
    Last Post: 11-17-2009, 06:12 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •