changeset 12255:cabf2d0876ef

8050091: (coll) LinkedList has incorrect implementation comment Summary: Rework implementation invariant comments Reviewed-by: igerasim
author martin
date Mon, 29 Jun 2015 14:59:20 -0700
parents 119f69c81d70
children 7fe849a62bea
files src/java.base/share/classes/java/util/LinkedList.java
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/LinkedList.java	Tue Jun 30 01:17:45 2015 +0300
+++ b/src/java.base/share/classes/java/util/LinkedList.java	Mon Jun 29 14:59:20 2015 -0700
@@ -88,18 +88,22 @@
 
     /**
      * Pointer to first node.
-     * Invariant: (first == null && last == null) ||
-     *            (first.prev == null && first.item != null)
      */
     transient Node<E> first;
 
     /**
      * Pointer to last node.
-     * Invariant: (first == null && last == null) ||
-     *            (last.next == null && last.item != null)
      */
     transient Node<E> last;
 
+    /*
+    void dataStructureInvariants() {
+        assert (size == 0)
+            ? (first == null && last == null)
+            : (first.prev == null && last.next == null);
+    }
+    */
+
     /**
      * Constructs an empty list.
      */