Collections and Generics
NumberNames nn = new NumberNames();
nn.put("one",1);
System.out.println(nn.getNames());
Place the code into position to create a class that maps from String to integer values.
The resultof execution must be [one] . Some options may be used more than once
public class NumberNames{
private HashMap < (1) Place here , (2) Place here > map =
new HashMap < (3) Place here , (4) Place here, (5) Place here ;
public void put(String name, int value){
map.put( (6)Place here, (7)Place here );
}
public (8)Place here getNames() {
return map.keySet();
}
}Codefor placement
| (A) Set < int > | (G) Set < String , int > | (M) > |
| (B) Set < Integer > | (H) Set < String > | (N) > ( ) |
| (C) HashSet | (I) NumberNames | (O) name |
| (D) Set < Integer , String > | (J) String | (p) value |
| (E) Set < int, String > | (K) Integer | (Q) map |
| (F) Set < String, Integer > | (L) int |