permaculture playing cards*
The moose likes Java in General and the fly likes adding a bunch of list to a set Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "adding a bunch of list to a set" Watch "adding a bunch of list to a set" New topic
Author

adding a bunch of list to a set

Max Vandenburg
Ranch Hand

Joined: Mar 09, 2006
Posts: 51
say i have a Map, a HashMap

and its key is a bunch of Integer and the values is a List of strings. i.e.


then i have a Set that stores a list and it looks like this:



from the above set we can see that in the first list is ["A", "B", "C", "D", "F", "G" ]

and this list belongs matchest the value in the map with the key 1 and 3.

for the second list in the set ["A", "B", "E", "D", "F", "G"], this list matchest the value in the map with the key 2 and 3

i've built up a rough code to build the map and the setOfList, see code,



anyone can help me solve this,

thanks
[ October 03, 2006: Message edited by: Firman Drage ]

MV
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Well, if I had to do it, I would have done this to load the lists;

With JDK 1.5:



With JDK 1.4


Now, I do not clearly understand the rest of your algoritm or its purpose.

I hope that helps!
[ October 03, 2006: Message edited by: Edwin Dalorzo ]
 
Consider Paul's rocket mass heater.
 
subject: adding a bunch of list to a set
 
Similar Threads
Are List<?> and List<? extends Object> are absolutely identical?
Iterator better for that?
Clarification required on synchronized block
Removing all instances of an integer from an array
Generics Question: