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

Method main

collections/AsListInference.java:15–33  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

13
14public class AsListInference {
15 public static void main(String[] args) {
16 List<Snow> snow1 = Arrays.asList(
17 new Crusty(), new Slush(), new Powder());
18 //- snow1.add(new Heavy()); // Exception
19
20 List<Snow> snow2 = Arrays.asList(
21 new Light(), new Heavy());
22 //- snow2.add(new Slush()); // Exception
23
24 List<Snow> snow3 = new ArrayList<>();
25 Collections.addAll(snow3,
26 new Light(), new Heavy(), new Powder());
27 snow3.add(new Crusty());
28
29 // Hint with explicit type argument specification:
30 List<Snow> snow4 = Arrays.<Snow>asList(
31 new Light(), new Heavy(), new Slush());
32 //- snow4.add(new Powder()); // Exception
33 }
34}

Callers

nothing calls this directly

Calls 2

addAllMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected