8150953: j.l.i.MethodHandles: example section in whileLoop(...) provides example for doWhileLoop
authormhaupt
Wed, 02 Mar 2016 14:15:15 +0100
changeset 36218 f02215b8d857
parent 36217 cc64f9fb2062
child 36219 437e72684a42
8150953: j.l.i.MethodHandles: example section in whileLoop(...) provides example for doWhileLoop Reviewed-by: psandoz
jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
jdk/test/java/lang/invoke/JavaDocExamplesTest.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Mar 02 14:10:40 2016 +0300
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Wed Mar 02 14:15:15 2016 +0100
@@ -3528,7 +3528,7 @@
      *   return zip;
      * }
      * // assume MH_initZip, MH_zipPred, and MH_zipStep are handles to the above methods
-     * MethodHandle loop = MethodHandles.doWhileLoop(MH_initZip, MH_zipStep, MH_zipPred);
+     * MethodHandle loop = MethodHandles.whileLoop(MH_initZip, MH_zipPred, MH_zipStep);
      * List<String> a = Arrays.asList("a", "b", "c", "d");
      * List<String> b = Arrays.asList("e", "f", "g", "h");
      * List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Wed Mar 02 14:10:40 2016 +0300
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java	Wed Mar 02 14:15:15 2016 +0100
@@ -690,7 +690,7 @@
         {{
 {} /// JAVADOC
 // implement the zip function for lists as a loop handle
-MethodHandle loop = MethodHandles.doWhileLoop(MH_initZip, MH_zipStep, MH_zipPred);
+MethodHandle loop = MethodHandles.whileLoop(MH_initZip, MH_zipPred, MH_zipStep);
 List<String> a = Arrays.asList("a", "b", "c", "d");
 List<String> b = Arrays.asList("e", "f", "g", "h");
 List<String> zipped = Arrays.asList("a", "e", "b", "f", "c", "g", "d", "h");