geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r1049695 - in /geronimo/xbean/trunk/xbean-finder/src: main/java/org/apache/xbean/finder/SingleLinkedList.java test/java/org/apache/xbean/finder/SingleLinkedListTest.java
Date Wed, 15 Dec 2010 20:25:34 GMT
Author: rickmcguire
Date: Wed Dec 15 20:25:34 2010
New Revision: 1049695

URL: http://svn.apache.org/viewvc?rev=1049695&view=rev
Log:
Fix a couple of errors in the SingleLinkedList class

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/SingleLinkedList.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/SingleLinkedListTest.java

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/SingleLinkedList.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/SingleLinkedList.java?rev=1049695&r1=1049694&r2=1049695&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/SingleLinkedList.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/SingleLinkedList.java
Wed Dec 15 20:25:34 2010
@@ -45,7 +45,7 @@ public class SingleLinkedList<E> impleme
     }
 
     public boolean isEmpty() {
-        return size() > 0;
+        return size() == 0;
     }
 
     public boolean contains(Object o) {
@@ -116,6 +116,7 @@ public class SingleLinkedList<E> impleme
 
     public void clear() {
         this.entry = null;
+        this.size = 0; 
     }
 
     public E get(int index) {

Modified: geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/SingleLinkedListTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/SingleLinkedListTest.java?rev=1049695&r1=1049694&r2=1049695&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/SingleLinkedListTest.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/SingleLinkedListTest.java
Wed Dec 15 20:25:34 2010
@@ -151,5 +151,17 @@ public class SingleLinkedListTest extend
             // pass
         }
     }
+    
+    public void testIsEmpty() {
+        SingleLinkedList<String> temp = new SingleLinkedList<String>();
+        assertTrue(temp.isEmpty());
+        assertEquals(0, temp.size());
+        temp.add("one"); 
+        assertFalse(temp.isEmpty());
+        assertEquals(1, temp.size());
+        temp.clear(); 
+        assertTrue(temp.isEmpty());
+        assertEquals(0, temp.size());
+    }
 
 }



Mime
View raw message