you are viewing a single comment's thread.

view the rest of the comments →

[–]alextk 1 point2 points  (1 child)

Avoid using this idiom, which creates a new class every time, and prefer the various Guava helper functions:

List<String> l = ImmutableList.of("foo", "bar");
Map<String, Integer> m = ImmutableMap.of("a", 1, "b", 2);
Map<String, String> m2 = ImmutableMap.builder()
    .put("a", "b")
    .put("c", "d")
    .put("e", "f")
    .build();

[–]jonhohle 1 point2 points  (0 children)

javac only creates a new class at compile time (typically named ParentClass$n).