jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r1301013 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk: model/ChildNodeEntriesMap.java model/ChildNodeEntriesTree.java util/EmptyIterator.java
Date Thu, 15 Mar 2012 14:48:27 GMT
Author: dpfister
Date: Thu Mar 15 14:48:27 2012
New Revision: 1301013

URL: http://svn.apache.org/viewvc?rev=1301013&view=rev
Log:
OAK-13 - Cleanup org.apache.jackrabbit.mk
- replace EmptyIterator class with Collections.emptySet().iterator

Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/util/EmptyIterator.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java?rev=1301013&r1=1301012&r2=1301013&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
Thu Mar 15 14:48:27 2012
@@ -18,11 +18,12 @@ package org.apache.jackrabbit.mk.model;
 
 import org.apache.jackrabbit.mk.store.Binding;
 import org.apache.jackrabbit.mk.util.AbstractFilteringIterator;
-import org.apache.jackrabbit.mk.util.EmptyIterator;
 import org.apache.jackrabbit.mk.util.RangeIterator;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -30,7 +31,7 @@ import java.util.Map;
  */
 public class ChildNodeEntriesMap implements ChildNodeEntries {
 
-    protected static final Iterator<ChildNodeEntry> EMPTY_ITER = new EmptyIterator<ChildNodeEntry>();
+    protected static final List<ChildNodeEntry> EMPTY = Collections.emptyList();
     
     protected HashMap<String, ChildNodeEntry> entries = new HashMap<String, ChildNodeEntry>();
 
@@ -90,7 +91,8 @@ public class ChildNodeEntriesMap impleme
             return entries.keySet().iterator();
         } else {
             if (offset >= entries.size() || count == 0) {
-                return new EmptyIterator<String>();
+                List<String> empty = Collections.emptyList();
+                return empty.iterator();
             }
             if (count == -1 || (offset + count) > entries.size()) {
                 count = entries.size() - offset;
@@ -108,7 +110,7 @@ public class ChildNodeEntriesMap impleme
             return entries.values().iterator();
         } else {
             if (offset >= entries.size() || count == 0) {
-                return EMPTY_ITER;
+                return EMPTY.iterator();
             }
             if (count == -1 || (offset + count) > entries.size()) {
                 count = entries.size() - offset;
@@ -157,7 +159,7 @@ public class ChildNodeEntriesMap impleme
     @Override
     public Iterator<ChildNodeEntry> getAdded(final ChildNodeEntries other) {
         if (equals(other)) {
-            return EMPTY_ITER;            
+            return EMPTY.iterator();            
         }
         
         return new AbstractFilteringIterator<ChildNodeEntry>(other.getEntries(0, -1))
{
@@ -171,7 +173,7 @@ public class ChildNodeEntriesMap impleme
     @Override
     public Iterator<ChildNodeEntry> getRemoved(final ChildNodeEntries other) {
         if (equals(other)) {
-            return EMPTY_ITER;
+            return EMPTY.iterator();
         }
 
         return new AbstractFilteringIterator<ChildNodeEntry>(entries.values().iterator())
{
@@ -185,7 +187,7 @@ public class ChildNodeEntriesMap impleme
     @Override
     public Iterator<ChildNodeEntry> getModified(final ChildNodeEntries other) {
         if (equals(other)) {
-            return EMPTY_ITER;
+            return EMPTY.iterator();
         }
         return new AbstractFilteringIterator<ChildNodeEntry>(getEntries(0, -1)) {
             @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java?rev=1301013&r1=1301012&r2=1301013&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
Thu Mar 15 14:48:27 2012
@@ -21,10 +21,10 @@ import org.apache.jackrabbit.mk.store.Re
 import org.apache.jackrabbit.mk.store.RevisionStore;
 import org.apache.jackrabbit.mk.util.AbstractFilteringIterator;
 import org.apache.jackrabbit.mk.util.AbstractRangeIterator;
-import org.apache.jackrabbit.mk.util.EmptyIterator;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
@@ -34,8 +34,8 @@ import java.util.NoSuchElementException;
  */
 public class ChildNodeEntriesTree implements ChildNodeEntries {
 
-    protected static final Iterator<ChildNodeEntry> EMPTY_ITER = new EmptyIterator<ChildNodeEntry>();
-
+    protected static final List<ChildNodeEntry> EMPTY = Collections.emptyList();
+    
     protected int count;
     
     protected RevisionProvider revProvider;
@@ -113,7 +113,8 @@ public class ChildNodeEntriesTree implem
         }
 
         if (offset >= count || cnt == 0) {
-            return new EmptyIterator<String>();
+            List<String> empty = Collections.emptyList();
+            return empty.iterator();
         }
 
         if (cnt == -1 || (offset + cnt) > count) {
@@ -136,7 +137,7 @@ public class ChildNodeEntriesTree implem
         }
 
         if (offset >= count || cnt == 0) {
-            return EMPTY_ITER;
+            return EMPTY.iterator();
         }
 
         int skipped = 0;
@@ -290,7 +291,7 @@ public class ChildNodeEntriesTree implem
     @Override
     public Iterator<ChildNodeEntry> getAdded(final ChildNodeEntries other) {
         if (equals(other)) {
-            return EMPTY_ITER;
+            return EMPTY.iterator();
         }
 
         if (other instanceof ChildNodeEntriesTree) {
@@ -367,7 +368,7 @@ public class ChildNodeEntriesTree implem
     @Override
     public Iterator<ChildNodeEntry> getRemoved(final ChildNodeEntries other) {
         if (equals(other)) {
-            return EMPTY_ITER;
+            return EMPTY.iterator();
         }
 
         if (other instanceof ChildNodeEntriesTree) {
@@ -444,7 +445,7 @@ public class ChildNodeEntriesTree implem
     @Override
     public Iterator<ChildNodeEntry> getModified(final ChildNodeEntries other) {
         if (equals(other)) {
-            return EMPTY_ITER;
+            return EMPTY.iterator();
         }
 
         if (other instanceof ChildNodeEntriesTree) {



Mime
View raw message