this is just an example full class. just run it and work on it to understand more about this issue
public class Tester5 {
/**
* @param args
*/
public static void main(String[] args) {
//"apple", "orange", "grape", etc. Each set will contain random numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9
Random ran = new Random();
Map> map= new HashMap>();
String keys[]= {"apple", "orange", "grape"};
for(String key : keys) {
Set integers= new HashSet();
for(int i = 0; i < 10; i++) {
integers.add(ran.nextInt(9)+1);
}
map.put(key, integers);
}
System.out.println(map.toString());
}
}