jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r379191 - /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
Date Mon, 20 Feb 2006 18:28:00 GMT
Author: angela
Date: Mon Feb 20 10:27:58 2006
New Revision: 379191

URL: http://svn.apache.org/viewcvs?rev=379191&view=rev
Log:
calculate initial size of the VersionIterator, since the size of the list is decreased in
every iteration by calling LinkedList#removeFirst.

Modified:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java?rev=379191&r1=379190&r2=379191&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
Mon Feb 20 10:27:58 2006
@@ -52,6 +52,11 @@
     private final SessionImpl session;
 
     /**
+     * The number of versions available.
+     */
+    private final long size;
+
+    /**
      * Creates a new VersionIterator that iterates over the version tree,
      * starting the root node.
      *
@@ -61,6 +66,8 @@
         this.session = (SessionImpl) session;
 
         addVersion(rootVersion);
+        // retrieve inital size, since size of the list is not stable
+        size = versions.size();
     }
 
     /**
@@ -94,7 +101,7 @@
      * {@inheritDoc}
      */
     public long getSize() {
-        return versions.size();
+        return size;
     }
 
     /**



Mime
View raw message