src/java.base/share/classes/java/util/ArrayDeque.java
changeset 47307 6864969a78ad
parent 47216 71c04702a3d5
child 47423 4fc2a4a29f3d
--- a/src/java.base/share/classes/java/util/ArrayDeque.java	Tue Oct 03 13:55:05 2017 -0700
+++ b/src/java.base/share/classes/java/util/ArrayDeque.java	Tue Oct 03 14:00:00 2017 -0700
@@ -211,7 +211,7 @@
     }
 
     /**
-     * Increments i, mod modulus.
+     * Circularly increments i, mod modulus.
      * Precondition and postcondition: 0 <= i < modulus.
      */
     static final int inc(int i, int modulus) {
@@ -220,7 +220,7 @@
     }
 
     /**
-     * Decrements i, mod modulus.
+     * Circularly decrements i, mod modulus.
      * Precondition and postcondition: 0 <= i < modulus.
      */
     static final int dec(int i, int modulus) {
@@ -233,7 +233,7 @@
      * Precondition: 0 <= i < modulus, 0 <= distance <= modulus.
      * @return index 0 <= i < modulus
      */
-    static final int add(int i, int distance, int modulus) {
+    static final int inc(int i, int distance, int modulus) {
         if ((i += distance) - modulus >= 0) i -= modulus;
         return i;
     }
@@ -825,7 +825,7 @@
             final int i, n;
             return ((n = sub(getFence(), i = cursor, es.length) >> 1) <= 0)
                 ? null
-                : new DeqSpliterator(i, cursor = add(i, n, es.length));
+                : new DeqSpliterator(i, cursor = inc(i, n, es.length));
         }
 
         public void forEachRemaining(Consumer<? super E> action) {