New Features
-Added: Count method for Iterable -Fixed: A couple of bugs with the new stream removers not working well in LinkedCollections
This commit is contained in:
+16
@@ -404,6 +404,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
|
||||
int index = firstIndex;
|
||||
while(index != -1) {
|
||||
if(filter.TEST_VALUE(keys[index])) return true;
|
||||
index = (int)links[index];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -414,6 +415,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
|
||||
int index = firstIndex;
|
||||
while(index != -1) {
|
||||
if(filter.TEST_VALUE(keys[index])) return false;
|
||||
index = (int)links[index];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -424,6 +426,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
|
||||
int index = firstIndex;
|
||||
while(index != -1) {
|
||||
if(!filter.TEST_VALUE(keys[index])) return false;
|
||||
index = (int)links[index];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -434,10 +437,23 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
|
||||
int index = firstIndex;
|
||||
while(index != -1) {
|
||||
if(filter.TEST_VALUE(keys[index])) return keys[index];
|
||||
index = (int)links[index];
|
||||
}
|
||||
return EMPTY_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int count(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||
Objects.requireNonNull(filter);
|
||||
int result = 0;
|
||||
int index = firstIndex;
|
||||
while(index != -1) {
|
||||
if(filter.TEST_VALUE(keys[index])) result++;
|
||||
index = (int)links[index];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNodeAdded(int pos) {
|
||||
if(size == 0) {
|
||||
|
||||
Reference in New Issue
Block a user