looks fine joe > On May 31, 2016, at 9:31 PM, Joseph D. Darcy <[email protected]> wrote: > > Hello, > > The String.join javadoc contains some sample code to demonstrate how to use > the method. The sample code can be improved with the new-in-JDK-9 List > convenience factory method. Please review this patch to update the sample > code: > > --- a/src/java.base/share/classes/java/lang/String.java Tue May 31 > 17:54:41 2016 -0700 > +++ b/src/java.base/share/classes/java/lang/String.java Tue May 31 > 18:27:45 2016 -0700 > @@ -2424,9 +2424,7 @@ > * > * <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" > * > > (A corresponding update should *not* be made to the String.join sample using > a Set since the Set convenience factory methods do not guarantee ordering.) > > Thanks, > > -Joe
<http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037 Oracle Java Engineering 1 Network Drive Burlington, MA 01803 [email protected] <mailto:[email protected]>
