Finishing the ConcurrentMap implementation

This though isn't finishing the rest because the interface still needs
to be implemented.
-Added: Rest of the ConcurrentMap implementation
-Fixed: LinkedOpenHashMap Count method was returning prematurely.
This commit is contained in:
Speiger 2022-04-11 03:20:28 +02:00
parent 4f98c599df
commit 0350a77dff
2 changed files with 1058 additions and 12 deletions

View File

@ -905,9 +905,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
#endif #endif
@Override @Override
public boolean add(KEY_TYPE o) { public boolean add(KEY_TYPE o) { throw new UnsupportedOperationException(); }
throw new UnsupportedOperationException();
}
@Override @Override
public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); }
@ -1089,7 +1087,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int result = 0; int result = 0;
int index = firstIndex; int index = firstIndex;
while(index != -1){ while(index != -1){
if(filter.TEST_VALUE(keys[index])) return result++; if(filter.TEST_VALUE(keys[index])) result++;
index = (int)links[index]; index = (int)links[index];
} }
return result; return result;
@ -1371,7 +1369,6 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
@Override @Override
public void add(VALUE_TYPE e) { throw new UnsupportedOperationException(); } public void add(VALUE_TYPE e) { throw new UnsupportedOperationException(); }
} }
private class MapIterator { private class MapIterator {