Results 1 to 2 of 2
  1. #1
    thorne_ is offline Member
    Join Date
    Apr 2009
    Posts
    12
    Rep Power
    0

    Default Comparing List of maps

    Hi,

    I need to be able, in my code, to determine if objects are the 'same' based on one key-value pairing held in a map.

    I have 2 lists of objects that each contain a map of parameters. In side these parameters is an ID value.

    I want to compare the objects within each list based on this ID Value.

    Is this possible in any other way than a loop inside another loop using
    Java Code:
    Map.containsKey(ID)
    ?

    thanks in advance

  2. #2
    JohnnyR is offline Member
    Join Date
    Feb 2009
    Posts
    46
    Rep Power
    0

    Default

    I guess if it's two maps and you want to compare values you could try..

    Java Code:
    if (Map.containsValue(SecondMap.get(Key))
    This basically just checks that the map you have contains the value of the second map comparing against (but you need the key obviously so you may just iterate through it)
    (just figured alternatively you could do it the other way round (containsKey (then containsValue).

Similar Threads

  1. Maps
    By natep67 in forum New To Java
    Replies: 8
    Last Post: 05-06-2009, 03:59 AM
  2. How do I Link data of two maps toghther?
    By javanoobie in forum New To Java
    Replies: 13
    Last Post: 04-13-2009, 05:37 PM
  3. How to access ArrayList in List of List?
    By alvations in forum New To Java
    Replies: 5
    Last Post: 10-08-2008, 12:23 PM
  4. Caching dynamic-maps in Hibernate
    By leonus in forum JDBC
    Replies: 0
    Last Post: 06-02-2008, 01:06 PM
  5. Google Maps API
    By mew in forum New To Java
    Replies: 0
    Last Post: 12-26-2007, 10:28 AM

Posting Permissions

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