Fixed that setValue wasn't working with ForEach implementations.
This commit is contained in:
parent
bcc2ffdc13
commit
0f9751bf70
|
@ -3,6 +3,7 @@
|
||||||
### Version 0.8.0
|
### Version 0.8.0
|
||||||
- Added: getFirst/getLast/removeFirst/removeLast to Lists
|
- Added: getFirst/getLast/removeFirst/removeLast to Lists
|
||||||
- Added: Dedicated implementations for toArray into TreeSets
|
- Added: Dedicated implementations for toArray into TreeSets
|
||||||
|
- Fixed: forEach methods in Maps now can use "setValue" functions.
|
||||||
|
|
||||||
### Version 0.8.0
|
### Version 0.8.0
|
||||||
- Added: ISizeProvider interface (Optimization Helper)
|
- Added: ISizeProvider interface (Optimization Helper)
|
||||||
|
|
|
@ -652,7 +652,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1){
|
while(index != -1){
|
||||||
action.accept(new BasicEntryKV_BRACES(seg.keys[index], seg.values[index]));
|
action.accept(new MapEntry(index, i));
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -664,14 +664,14 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0,m=segments.length;i<m;i++) {
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
long stamp = seg.readLock();
|
long stamp = seg.readLock();
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1){
|
while(index != -1){
|
||||||
entry.set(seg.keys[index], seg.values[index]);
|
entry.set(index, i);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
action.accept(count++, new BasicEntryKV_BRACES(seg.keys[index], seg.values[index]));
|
action.accept(count++, new MapEntry(index, i));
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -711,7 +711,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
action.accept(input, new BasicEntryKV_BRACES(seg.keys[index], seg.values[index]));
|
action.accept(input, new MapEntry(index, i));
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -724,14 +724,14 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0,m=segments.length;i<m;i++) {
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
long stamp = seg.readLock();
|
long stamp = seg.readLock();
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(seg.keys[index], seg.values[index]);
|
entry.set(index, i);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
|
@ -746,14 +746,14 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0,m=segments.length;i<m;i++) {
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
long stamp = seg.readLock();
|
long stamp = seg.readLock();
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(seg.keys[index], seg.values[index]);
|
entry.set(index, i);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
|
@ -768,14 +768,14 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0,m=segments.length;i<m;i++) {
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
long stamp = seg.readLock();
|
long stamp = seg.readLock();
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(seg.keys[index], seg.values[index]);
|
entry.set(index, i);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
|
@ -797,7 +797,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(seg.keys[index], seg.values[index]));
|
state = operator.apply(state, new MapEntry(index, i));
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -821,11 +821,11 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
if(empty) {
|
if(empty) {
|
||||||
empty = false;
|
empty = false;
|
||||||
state = new BasicEntryKV_BRACES(seg.keys[index], seg.values[index]);
|
state = new MapEntry(index, i);
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(seg.keys[index], seg.values[index]));
|
state = operator.apply(state, new MapEntry(index, i));
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -839,14 +839,14 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0,m=segments.length;i<m;i++) {
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
long stamp = seg.readLock();
|
long stamp = seg.readLock();
|
||||||
try {
|
try {
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(seg.keys[index], seg.values[index]);
|
entry.set(index, i);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
|
@ -862,14 +862,14 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
||||||
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
int result = 0;
|
int result = 0;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0,m=segments.length;i<m;i++) {
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
long stamp = seg.readLock();
|
long stamp = seg.readLock();
|
||||||
try {
|
try {
|
||||||
int index = seg.firstIndex;
|
int index = seg.firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(seg.keys[index], seg.values[index]);
|
entry.set(index, i);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
index = (int)seg.links[index];
|
index = (int)seg.links[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -680,17 +680,17 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
action.accept(new BasicEntryKV_BRACES(keys[index], values[index]));
|
action.accept(new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -703,7 +703,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
action.accept(count++, new BasicEntryKV_BRACES(keys[index], values[index]));
|
action.accept(count++, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -714,7 +714,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
if(size() <= 0) return;
|
if(size() <= 0) return;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
action.accept(input, new BasicEntryKV_BRACES(keys[index], values[index]));
|
action.accept(input, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,10 +723,10 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return false;
|
if(size() <= 0) return false;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -737,10 +737,10 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -751,10 +751,10 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -767,7 +767,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
E state = identity;
|
E state = identity;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[index], values[index]));
|
state = operator.apply(state, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
@ -782,11 +782,11 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
if(empty) {
|
if(empty) {
|
||||||
empty = false;
|
empty = false;
|
||||||
state = new BasicEntryKV_BRACES(keys[index], values[index]);
|
state = new MapEntry(index);
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[index], values[index]));
|
state = operator.apply(state, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
@ -796,10 +796,10 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return null;
|
if(size() <= 0) return null;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -810,11 +810,11 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
||||||
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return 0;
|
if(size() <= 0) return 0;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -798,6 +798,10 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE ENTRY_KEY() {
|
public KEY_TYPE ENTRY_KEY() {
|
||||||
return keys[index];
|
return keys[index];
|
||||||
|
@ -862,21 +866,21 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
if(containsNull) action.accept(new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) action.accept(new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1;i>=0;i--)
|
for(int i = nullIndex-1;i>=0;i--)
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(new BasicEntryKV_BRACES(keys[i], values[i]));
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(new MapEntry(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -886,9 +890,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public void forEachIndexed(IntObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEachIndexed(IntObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
if(size() <= 0) return;
|
if(size() <= 0) return;
|
||||||
if(containsNull) action.accept(0, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) action.accept(0, new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(index++, new BasicEntryKV_BRACES(keys[i], values[i]));
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(index++, new MapEntry(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,9 +900,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public <E> void forEach(E input, ObjectObjectConsumer<E, MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public <E> void forEach(E input, ObjectObjectConsumer<E, MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
if(size() <= 0) return;
|
if(size() <= 0) return;
|
||||||
if(containsNull) action.accept(input, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) action.accept(input, new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(input, new BasicEntryKV_BRACES(keys[i], values[i]));
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(input, new MapEntry(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,14 +910,14 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return false;
|
if(size() <= 0) return false;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -924,14 +928,14 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -942,14 +946,14 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -960,10 +964,10 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public <E> E reduce(E identity, BiFunction<E, MAP.Entry KEY_VALUE_GENERIC_TYPE, E> operator) {
|
public <E> E reduce(E identity, BiFunction<E, MAP.Entry KEY_VALUE_GENERIC_TYPE, E> operator) {
|
||||||
Objects.requireNonNull(operator);
|
Objects.requireNonNull(operator);
|
||||||
E state = identity;
|
E state = identity;
|
||||||
if(containsNull) state = operator.apply(state, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) state = operator.apply(state, new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(strategy.equals(keys[i], EMPTY_KEY_VALUE)) continue;
|
if(strategy.equals(keys[i], EMPTY_KEY_VALUE)) continue;
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[i], values[i]));
|
state = operator.apply(state, new MapEntry(i));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -974,17 +978,17 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
MAP.Entry KEY_VALUE_GENERIC_TYPE state = null;
|
MAP.Entry KEY_VALUE_GENERIC_TYPE state = null;
|
||||||
boolean empty = true;
|
boolean empty = true;
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
state = new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]);
|
state = new MapEntry(nullIndex);
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(strategy.equals(keys[i], EMPTY_KEY_VALUE)) continue;
|
if(strategy.equals(keys[i], EMPTY_KEY_VALUE)) continue;
|
||||||
if(empty) {
|
if(empty) {
|
||||||
empty = false;
|
empty = false;
|
||||||
state = new BasicEntryKV_BRACES(keys[i], values[i]);
|
state = new MapEntry(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[i], values[i]));
|
state = operator.apply(state, new MapEntry(i));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -993,14 +997,14 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return null;
|
if(size() <= 0) return null;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1011,15 +1015,15 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
||||||
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return 0;
|
if(size() <= 0) return 0;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -684,17 +684,17 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1){
|
while(index != -1){
|
||||||
action.accept(new BasicEntryKV_BRACES(keys[index], values[index]));
|
action.accept(new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1){
|
while(index != -1){
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -707,7 +707,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
action.accept(count++, new BasicEntryKV_BRACES(keys[index], values[index]));
|
action.accept(count++, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
if(size() <= 0) return;
|
if(size() <= 0) return;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
action.accept(input, new BasicEntryKV_BRACES(keys[index], values[index]));
|
action.accept(input, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -727,10 +727,10 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return false;
|
if(size() <= 0) return false;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -741,10 +741,10 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -755,10 +755,10 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -771,7 +771,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
E state = identity;
|
E state = identity;
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[index], values[index]));
|
state = operator.apply(state, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
@ -786,11 +786,11 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
if(empty) {
|
if(empty) {
|
||||||
empty = false;
|
empty = false;
|
||||||
state = new BasicEntryKV_BRACES(keys[index], values[index]);
|
state = new MapEntry(index);
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[index], values[index]));
|
state = operator.apply(state, new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
@ -800,10 +800,10 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return null;
|
if(size() <= 0) return null;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -815,10 +815,10 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return 0;
|
if(size() <= 0) return 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1) {
|
while(index != -1) {
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -757,6 +757,10 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE ENTRY_KEY() {
|
public KEY_TYPE ENTRY_KEY() {
|
||||||
return keys[index];
|
return keys[index];
|
||||||
|
@ -821,21 +825,21 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
if(containsNull) action.accept(new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) action.accept(new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1;i>=0;i--)
|
for(int i = nullIndex-1;i>=0;i--)
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(new BasicEntryKV_BRACES(keys[i], values[i]));
|
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(new MapEntry(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -845,9 +849,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public void forEachIndexed(IntObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEachIndexed(IntObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
if(size() <= 0) return;
|
if(size() <= 0) return;
|
||||||
if(containsNull) action.accept(0, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) action.accept(0, new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
for(int i = nullIndex-1, index = containsNull ? 1 : 0;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(index++, new BasicEntryKV_BRACES(keys[i], values[i]));
|
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(index++, new MapEntry(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -855,9 +859,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public <E> void forEach(E input, ObjectObjectConsumer<E, MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public <E> void forEach(E input, ObjectObjectConsumer<E, MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
if(size() <= 0) return;
|
if(size() <= 0) return;
|
||||||
if(containsNull) action.accept(input, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) action.accept(input, new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(input, new BasicEntryKV_BRACES(keys[i], values[i]));
|
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(input, new MapEntry(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,14 +869,14 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return false;
|
if(size() <= 0) return false;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -883,14 +887,14 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -901,14 +905,14 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,10 +923,10 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public <E> E reduce(E identity, BiFunction<E, MAP.Entry KEY_VALUE_GENERIC_TYPE, E> operator) {
|
public <E> E reduce(E identity, BiFunction<E, MAP.Entry KEY_VALUE_GENERIC_TYPE, E> operator) {
|
||||||
Objects.requireNonNull(operator);
|
Objects.requireNonNull(operator);
|
||||||
E state = identity;
|
E state = identity;
|
||||||
if(containsNull) state = operator.apply(state, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]));
|
if(containsNull) state = operator.apply(state, new MapEntry(nullIndex));
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NULL(keys[i])) continue;
|
if(KEY_EQUALS_NULL(keys[i])) continue;
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[i], values[i]));
|
state = operator.apply(state, new MapEntry(i));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -933,17 +937,17 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
MAP.Entry KEY_VALUE_GENERIC_TYPE state = null;
|
MAP.Entry KEY_VALUE_GENERIC_TYPE state = null;
|
||||||
boolean empty = true;
|
boolean empty = true;
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
state = new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]);
|
state = new MapEntry(nullIndex);
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NULL(keys[i])) continue;
|
if(KEY_EQUALS_NULL(keys[i])) continue;
|
||||||
if(empty) {
|
if(empty) {
|
||||||
empty = false;
|
empty = false;
|
||||||
state = new BasicEntryKV_BRACES(keys[i], values[i]);
|
state = new MapEntry(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[i], values[i]));
|
state = operator.apply(state, new MapEntry(i));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -952,14 +956,14 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return null;
|
if(size() <= 0) return null;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -970,15 +974,15 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
||||||
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public int count(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return 0;
|
if(size() <= 0) return 0;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if(containsNull) {
|
if(containsNull) {
|
||||||
entry.set(keys[nullIndex], values[nullIndex]);
|
entry.set(nullIndex);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
}
|
}
|
||||||
for(int i = nullIndex-1;i>=0;i--) {
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
if(KEY_EQUALS_NOT_NULL(keys[i])) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -788,16 +788,16 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
for(int i = 0;i<size;i++)
|
for(int i = 0;i<size;i++)
|
||||||
action.accept(new BasicEntryKV_BRACES(keys[i], values[i]));
|
action.accept(new MapEntry(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
if(size() <= 0) return;
|
if(size() <= 0) return;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,7 +806,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public void forEachIndexed(IntObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEachIndexed(IntObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
action.accept(i, new BasicEntryKV_BRACES(keys[i], values[i]));
|
action.accept(i, new MapEntry(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,7 +814,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public <E> void forEach(E input, ObjectObjectConsumer<E, MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public <E> void forEach(E input, ObjectObjectConsumer<E, MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
action.accept(input, new BasicEntryKV_BRACES(keys[i], values[i]));
|
action.accept(input, new MapEntry(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -822,9 +822,9 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return false;
|
if(size() <= 0) return false;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return true;
|
if(filter.test(entry)) return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -834,9 +834,9 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesNone(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return false;
|
if(filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -846,9 +846,9 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAll(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return true;
|
if(size() <= 0) return true;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(!filter.test(entry)) return false;
|
if(!filter.test(entry)) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -859,7 +859,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
Objects.requireNonNull(operator);
|
Objects.requireNonNull(operator);
|
||||||
E state = identity;
|
E state = identity;
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[i], values[i]));
|
state = operator.apply(state, new MapEntry(i));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -872,10 +872,10 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
if(empty) {
|
if(empty) {
|
||||||
empty = false;
|
empty = false;
|
||||||
state = new BasicEntryKV_BRACES(keys[i], values[i]);
|
state = new MapEntry(i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
state = operator.apply(state, new BasicEntryKV_BRACES(keys[i], values[i]));
|
state = operator.apply(state, new MapEntry(i));
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -884,9 +884,9 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return null;
|
if(size() <= 0) return null;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) return entry;
|
if(filter.test(entry)) return entry;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -897,9 +897,9 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
if(size() <= 0) return 0;
|
if(size() <= 0) return 0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
for(int i = 0;i<size;i++) {
|
for(int i = 0;i<size;i++) {
|
||||||
entry.set(keys[i], values[i]);
|
entry.set(i);
|
||||||
if(filter.test(entry)) result++;
|
if(filter.test(entry)) result++;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1405,6 +1405,10 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE ENTRY_KEY() {
|
public KEY_TYPE ENTRY_KEY() {
|
||||||
return keys[index];
|
return keys[index];
|
||||||
|
|
|
@ -685,6 +685,10 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE ENTRY_KEY() {
|
public KEY_TYPE ENTRY_KEY() {
|
||||||
return keys[index];
|
return keys[index];
|
||||||
|
|
|
@ -480,17 +480,17 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA
|
||||||
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1){
|
while(index != -1){
|
||||||
action.accept(new BasicEntryKV_BRACES(keys[index], values[index]));
|
action.accept(new MapEntry(index));
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
|
MapEntry entry = new MapEntry();
|
||||||
int index = firstIndex;
|
int index = firstIndex;
|
||||||
while(index != -1){
|
while(index != -1){
|
||||||
entry.set(keys[index], values[index]);
|
entry.set(index);
|
||||||
action.accept(entry);
|
action.accept(entry);
|
||||||
index = (int)links[index];
|
index = (int)links[index];
|
||||||
}
|
}
|
||||||
|
@ -911,6 +911,10 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA
|
||||||
this.index = index;
|
this.index = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set(int index) {
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE ENTRY_KEY() {
|
public KEY_TYPE ENTRY_KEY() {
|
||||||
return keys[index];
|
return keys[index];
|
||||||
|
|
Loading…
Reference in New Issue