fix some MGC classes
authorjzhou <jzhou>
Sat, 19 Nov 2011 00:57:39 +0000 (00:57 +0000)
committerjzhou <jzhou>
Sat, 19 Nov 2011 00:57:39 +0000 (00:57 +0000)
Robust/src/ClassLibrary/MGC/HashMap.java
Robust/src/ClassLibrary/MGC/gnu/LinkedList.java

index 1edd6c8f59cc7c046e542aa6eb099c3c06e01011..e28991a31d44f6e4dbd96f980c51d555baaf72ad 100644 (file)
@@ -156,13 +156,13 @@ public class HashMap implements Map {
         
         public int size()
         {
-          return size;
+          return numItems;
         }
 
         public Iterator iterator()
         {
           // Cannot create the iterator directly, because of LinkedHashMap.
-          return HashMapIterator(HashMap.this, 1);
+          return new HashMapIterator(HashMap.this, 1);
         }
 
         public void clear()
@@ -182,14 +182,14 @@ public class HashMap implements Map {
       {
         public int size()
         {
-          return size;
+          return numItems;
         }
 
         public Iterator iterator()
         {
           // Cannot create the iterator directly, because of LinkedHashMap.
           //return HashMap.this.iterator(KEYS);
-          return HashMapIterator(HashMap.this, 0);
+          return new HashMapIterator(HashMap.this, 0);
         }
 
         public void clear()
@@ -207,9 +207,9 @@ public class HashMap implements Map {
           // Test against the size of the HashMap to determine if anything
           // really got removed. This is necessary because the return value
           // of HashMap.remove() is ambiguous in the null case.
-          int oldsize = size;
+          int oldsize = numItems;
           HashMap.this.remove(o);
-          return oldsize != size;
+          return oldsize != numItems;
         }
       };
     return keys;
index e3991f9e2015f479cde7c78ce4e37ff29f7ca214..efbcfe930fdb8fda42c54f71bb7352a1e798ddd5 100644 (file)
@@ -21,7 +21,7 @@ public class LinkedList implements Queue {
     clear();
   }
 
-  public void add(Object o) {
+  public boolean add(Object o) {
     if( tail == null ) {
       head = new LinkedListElement(o, null, null);
       tail = head;