MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

collections/InterfaceVsIterator.java:21–37  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

19 System.out.println();
20 }
21 public static void main(String[] args) {
22 List<Pet> petList = new PetCreator().list(8);
23 Set<Pet> petSet = new HashSet<>(petList);
24 Map<String, Pet> petMap = new LinkedHashMap<>();
25 String[] names = ("Ralph, Eric, Robin, Lacey, " +
26 "Britney, Sam, Spot, Fluffy").split(", ");
27 for(int i = 0; i < names.length; i++)
28 petMap.put(names[i], petList.get(i));
29 display(petList);
30 display(petSet);
31 display(petList.iterator());
32 display(petSet.iterator());
33 System.out.println(petMap);
34 System.out.println(petMap.keySet());
35 display(petMap.values());
36 display(petMap.values().iterator());
37 }
38}
39/* Output:
400:Rat 1:Manx 2:Cymric 3:Mutt 4:Pug 5:Cymric 6:Pug

Callers

nothing calls this directly

Calls 7

displayMethod · 0.95
listMethod · 0.80
splitMethod · 0.80
valuesMethod · 0.80
getMethod · 0.65
putMethod · 0.45
iteratorMethod · 0.45

Tested by

no test coverage detected