Skip to content
This repository
Browse code

Fixes for #28 and #24

  • Loading branch information...
commit c167db4adfa976d32acb6d936655479a68db6190 1 parent 2611a76
Stéphane Épardaud FroMage authored
3  collection/source/ceylon/collection/HashMap.ceylon
@@ -64,7 +64,7 @@ shared class HashMap<Key, Item>()
64 64 shared actual void remove(Key key){
65 65 Integer index = storeIndex(key, store);
66 66 variable Cell<Key->Item>? bucket := store[index];
67   - variable Cell<Key->Item>? prev := bucket;
  67 + variable Cell<Key->Item>? prev := null;
68 68 while(exists Cell<Key->Item> cell = bucket){
69 69 if(cell.car.key == key){
70 70 // found it
@@ -76,6 +76,7 @@ shared class HashMap<Key, Item>()
76 76 _size--;
77 77 return;
78 78 }
  79 + prev := cell;
79 80 bucket := cell.cdr;
80 81 }
81 82 }
3  collection/source/ceylon/collection/HashSet.ceylon
@@ -64,7 +64,7 @@ shared class HashSet<Element>()
64 64 shared actual void remove(Element element){
65 65 Integer index = storeIndex(element, store);
66 66 variable Cell<Element>? bucket := store[index];
67   - variable Cell<Element>? prev := bucket;
  67 + variable Cell<Element>? prev := null;
68 68 while(exists Cell<Element> cell = bucket){
69 69 if(cell.car == element){
70 70 // found it
@@ -76,6 +76,7 @@ shared class HashSet<Element>()
76 76 _size--;
77 77 return;
78 78 }
  79 + prev := cell;
79 80 bucket := cell.cdr;
80 81 }
81 82 }

0 comments on commit c167db4

Please sign in to comment.
Something went wrong with that request. Please try again.