jdk/src/java.base/share/classes/java/lang/String.java
changeset 38765 b64f3ec3420e
parent 37723 1b9abe91485d
child 38786 8e7b0ac05815
--- a/jdk/src/java.base/share/classes/java/lang/String.java	Tue May 31 21:27:28 2016 -0400
+++ b/jdk/src/java.base/share/classes/java/lang/String.java	Tue May 31 19:13:21 2016 -0700
@@ -2424,15 +2424,12 @@
      *
      * <blockquote>For example,
      * <pre>{@code
-     *     List<String> strings = new LinkedList<>();
-     *     strings.add("Java");strings.add("is");
-     *     strings.add("cool");
+     *     List<String> strings = List.of("Java", "is", "cool");
      *     String message = String.join(" ", strings);
      *     //message returned is: "Java is cool"
      *
-     *     Set<String> strings = new LinkedHashSet<>();
-     *     strings.add("Java"); strings.add("is");
-     *     strings.add("very"); strings.add("cool");
+     *     Set<String> strings =
+     *         new LinkedHashSet<>(List.of("Java", "is", "very", "cool"));
      *     String message = String.join("-", strings);
      *     //message returned is: "Java-is-very-cool"
      * }</pre></blockquote>