Results 1 to 2 of 2
Thread: Comparing List of maps
- 06-09-2009, 04:19 PM #1
Member
- Join Date
- Apr 2009
- Posts
- 12
- Rep Power
- 0
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
- 06-10-2009, 02:30 AM #2
Member
- Join Date
- Feb 2009
- Posts
- 46
- Rep Power
- 0
I guess if it's two maps and you want to compare values you could try..
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)Java Code:if (Map.containsValue(SecondMap.get(Key))
(just figured alternatively you could do it the other way round (containsKey (then containsValue).
Similar Threads
-
Maps
By natep67 in forum New To JavaReplies: 8Last Post: 05-06-2009, 03:59 AM -
How do I Link data of two maps toghther?
By javanoobie in forum New To JavaReplies: 13Last Post: 04-13-2009, 05:37 PM -
How to access ArrayList in List of List?
By alvations in forum New To JavaReplies: 5Last Post: 10-08-2008, 12:23 PM -
Caching dynamic-maps in Hibernate
By leonus in forum JDBCReplies: 0Last Post: 06-02-2008, 01:06 PM -
Google Maps API
By mew in forum New To JavaReplies: 0Last Post: 12-26-2007, 10:28 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks