Updated to 0.9.0 src
This commit is contained in:
parent
49ce7fbfbe
commit
2a2d9e8d95
@ -12,6 +12,7 @@ import speiger.src.collections.booleans.collections.AbstractBooleanCollection;
|
|||||||
import speiger.src.collections.booleans.collections.BooleanCollection;
|
import speiger.src.collections.booleans.collections.BooleanCollection;
|
||||||
import speiger.src.collections.booleans.collections.BooleanIterator;
|
import speiger.src.collections.booleans.collections.BooleanIterator;
|
||||||
import speiger.src.collections.booleans.collections.BooleanSplititerator;
|
import speiger.src.collections.booleans.collections.BooleanSplititerator;
|
||||||
|
import speiger.src.collections.ints.lists.IntList;
|
||||||
import speiger.src.collections.booleans.utils.BooleanSplititerators;
|
import speiger.src.collections.booleans.utils.BooleanSplititerators;
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
|
||||||
@ -212,6 +213,16 @@ public abstract class AbstractBooleanList extends AbstractBooleanCollection impl
|
|||||||
return new BooleanListIter(index);
|
return new BooleanListIter(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(int...indecies) {
|
||||||
|
return new IndexedIterator(indecies);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(IntList indecies) {
|
||||||
|
return new ListIndexedIterator(indecies);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void size(int size) {
|
public void size(int size) {
|
||||||
while(size > size()) add(false);
|
while(size > size()) add(false);
|
||||||
@ -567,6 +578,152 @@ public abstract class AbstractBooleanList extends AbstractBooleanCollection impl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ListIndexedIterator implements BooleanListIterator {
|
||||||
|
IntList indecies;
|
||||||
|
int index;
|
||||||
|
int lastReturned = -1;
|
||||||
|
|
||||||
|
ListIndexedIterator(IntList indecies) {
|
||||||
|
this.indecies = indecies;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return index < indecies.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextBoolean() {
|
||||||
|
if(!hasNext()) throw new NoSuchElementException();
|
||||||
|
int i = index++;
|
||||||
|
return getBoolean((lastReturned = indecies.getInt(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPrevious() {
|
||||||
|
return index > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean previousBoolean() {
|
||||||
|
if(!hasPrevious()) throw new NoSuchElementException();
|
||||||
|
index--;
|
||||||
|
return getBoolean((lastReturned = indecies.getInt(index)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int nextIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int previousIndex() {
|
||||||
|
return index-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public void add(boolean e) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(boolean e) {
|
||||||
|
if(lastReturned == -1) throw new IllegalStateException();
|
||||||
|
AbstractBooleanList.this.set(lastReturned, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int skip(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, indecies.size() - index);
|
||||||
|
index += steps;
|
||||||
|
if(steps > 0) lastReturned = Math.min(index-1, indecies.size()-1);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int back(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, index);
|
||||||
|
index -= steps;
|
||||||
|
if(steps > 0) lastReturned = Math.max(index, 0);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class IndexedIterator implements BooleanListIterator {
|
||||||
|
int[] indecies;
|
||||||
|
int index;
|
||||||
|
int lastReturned = -1;
|
||||||
|
|
||||||
|
IndexedIterator(int[] indecies) {
|
||||||
|
this.indecies = indecies;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return index < indecies.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextBoolean() {
|
||||||
|
if(!hasNext()) throw new NoSuchElementException();
|
||||||
|
int i = index++;
|
||||||
|
return getBoolean((lastReturned = indecies[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPrevious() {
|
||||||
|
return index > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean previousBoolean() {
|
||||||
|
if(!hasPrevious()) throw new NoSuchElementException();
|
||||||
|
index--;
|
||||||
|
return getBoolean((lastReturned = indecies[index]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int nextIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int previousIndex() {
|
||||||
|
return index-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public void add(boolean e) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(boolean e) {
|
||||||
|
if(lastReturned == -1) throw new IllegalStateException();
|
||||||
|
AbstractBooleanList.this.set(lastReturned, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int skip(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, indecies.length - index);
|
||||||
|
index += steps;
|
||||||
|
if(steps > 0) lastReturned = Math.min(index-1, indecies.length-1);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int back(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, index);
|
||||||
|
index -= steps;
|
||||||
|
if(steps > 0) lastReturned = Math.max(index, 0);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class BooleanListIter implements BooleanListIterator {
|
private class BooleanListIter implements BooleanListIterator {
|
||||||
int index;
|
int index;
|
||||||
int lastReturned = -1;
|
int lastReturned = -1;
|
||||||
@ -644,7 +801,7 @@ public abstract class AbstractBooleanList extends AbstractBooleanCollection impl
|
|||||||
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
int steps = Math.min(amount, index);
|
int steps = Math.min(amount, index);
|
||||||
index -= steps;
|
index -= steps;
|
||||||
if(steps > 0) lastReturned = Math.min(index, size()-1);
|
if(steps > 0) lastReturned = Math.max(index, 0);
|
||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import speiger.src.collections.ints.functions.consumer.IntBooleanConsumer;
|
|||||||
import speiger.src.collections.booleans.functions.BooleanComparator;
|
import speiger.src.collections.booleans.functions.BooleanComparator;
|
||||||
import speiger.src.collections.booleans.utils.BooleanArrays;
|
import speiger.src.collections.booleans.utils.BooleanArrays;
|
||||||
import speiger.src.collections.booleans.utils.BooleanLists;
|
import speiger.src.collections.booleans.utils.BooleanLists;
|
||||||
|
import speiger.src.collections.ints.lists.IntList;
|
||||||
import speiger.src.collections.booleans.utils.BooleanSplititerators;
|
import speiger.src.collections.booleans.utils.BooleanSplititerators;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -320,6 +321,24 @@ public interface BooleanList extends BooleanCollection, List<Boolean>
|
|||||||
@Override
|
@Override
|
||||||
public BooleanListIterator listIterator(int index);
|
public BooleanListIterator listIterator(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Iterator that follows the indecies provided.<br>
|
||||||
|
* For example if the Lists Contents is:<br> -1, 0 1 <br>and the indecies are: <br>0, 1, 2, 2, 1, 0<br>
|
||||||
|
* then the iterator will return the following values: <br>-1, 0, 1, 1, 0, -1
|
||||||
|
* @param indecies that should be used for the iteration.
|
||||||
|
* @return a custom indexed iterator
|
||||||
|
*/
|
||||||
|
public BooleanListIterator indexedIterator(int...indecies);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Iterator that follows the indecies provided.<br>
|
||||||
|
* For example if the Lists Contents is:<br> -1, 0 1 <br>and the indecies are: <br>0, 1, 2, 2, 1, 0<br>
|
||||||
|
* then the iterator will return the following values: <br>-1, 0, 1, 1, 0, -1
|
||||||
|
* @param indecies that should be used for the iteration.
|
||||||
|
* @return a custom indexed iterator
|
||||||
|
*/
|
||||||
|
public BooleanListIterator indexedIterator(IntList indecies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type-Specific List of subList
|
* A Type-Specific List of subList
|
||||||
* @see java.util.List#subList(int, int)
|
* @see java.util.List#subList(int, int)
|
||||||
|
|||||||
@ -146,6 +146,15 @@ public class BooleanArrayFIFOQueue extends AbstractBooleanPriorityQueue implemen
|
|||||||
return index >= array.length ? array[index-array.length] : array[index];
|
return index >= array.length ? array[index-array.length] : array[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(boolean e) {
|
||||||
|
if(first == last) return false;
|
||||||
|
for(int i = 0,m=size();i<m;i++) {
|
||||||
|
if(e == array[(first + i) % array.length]) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeFirst(boolean e) {
|
public boolean removeFirst(boolean e) {
|
||||||
if(first == last) return false;
|
if(first == last) return false;
|
||||||
|
|||||||
@ -208,6 +208,13 @@ public class BooleanArrayPriorityQueue extends AbstractBooleanPriorityQueue
|
|||||||
return array[index];
|
return array[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(boolean e) {
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
if(e == array[i]) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeFirst(boolean e) {
|
public boolean removeFirst(boolean e) {
|
||||||
for(int i = 0;i<size;i++)
|
for(int i = 0;i<size;i++)
|
||||||
|
|||||||
@ -213,6 +213,13 @@ public class BooleanHeapPriorityQueue extends AbstractBooleanPriorityQueue
|
|||||||
return array[index];
|
return array[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(boolean e) {
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
if(e == array[i]) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeFirst(boolean e) {
|
public boolean removeFirst(boolean e) {
|
||||||
for(int i = 0;i<size;i++)
|
for(int i = 0;i<size;i++)
|
||||||
|
|||||||
@ -89,6 +89,13 @@ public interface BooleanPriorityQueue extends BooleanIterable
|
|||||||
*/
|
*/
|
||||||
public default boolean first() { return peek(0); }
|
public default boolean first() { return peek(0); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to find out if a element is part of the queue
|
||||||
|
* @param e the element that is searched for
|
||||||
|
* @return true if the element is in the queue
|
||||||
|
*/
|
||||||
|
public boolean contains(boolean e);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the first found element in the queue
|
* Removes the first found element in the queue
|
||||||
* @param e the element that should be removed
|
* @param e the element that should be removed
|
||||||
|
|||||||
@ -21,8 +21,7 @@ import speiger.src.collections.booleans.lists.BooleanList;
|
|||||||
import speiger.src.collections.booleans.lists.BooleanArrayList;
|
import speiger.src.collections.booleans.lists.BooleanArrayList;
|
||||||
import speiger.src.collections.objects.utils.ObjectAsyncBuilder;
|
import speiger.src.collections.objects.utils.ObjectAsyncBuilder;
|
||||||
import speiger.src.collections.objects.utils.ObjectAsyncBuilder.BaseObjectTask;
|
import speiger.src.collections.objects.utils.ObjectAsyncBuilder.BaseObjectTask;
|
||||||
import speiger.src.collections.ints.utils.IntAsyncBuilder;
|
import speiger.src.collections.ints.utils.IntAsyncBuilder;import speiger.src.collections.ints.utils.IntAsyncBuilder.BaseIntTask;
|
||||||
import speiger.src.collections.ints.utils.IntAsyncBuilder.BaseIntTask;
|
|
||||||
import speiger.src.collections.utils.ISizeProvider;
|
import speiger.src.collections.utils.ISizeProvider;
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package speiger.src.collections.booleans.utils;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import speiger.src.collections.booleans.collections.BooleanIterator;
|
import speiger.src.collections.booleans.collections.BooleanIterator;
|
||||||
import speiger.src.collections.objects.collections.ObjectIterator;
|
import speiger.src.collections.objects.collections.ObjectIterator;
|
||||||
@ -9,6 +10,7 @@ import speiger.src.collections.objects.utils.ObjectIterators;
|
|||||||
import speiger.src.collections.booleans.functions.BooleanConsumer;
|
import speiger.src.collections.booleans.functions.BooleanConsumer;
|
||||||
import speiger.src.collections.booleans.functions.BooleanComparator;
|
import speiger.src.collections.booleans.functions.BooleanComparator;
|
||||||
import speiger.src.collections.booleans.functions.function.BooleanFunction;
|
import speiger.src.collections.booleans.functions.function.BooleanFunction;
|
||||||
|
import speiger.src.collections.objects.functions.consumer.ObjectBooleanConsumer;
|
||||||
import speiger.src.collections.booleans.functions.function.BooleanPredicate;
|
import speiger.src.collections.booleans.functions.function.BooleanPredicate;
|
||||||
import speiger.src.collections.booleans.lists.BooleanList;
|
import speiger.src.collections.booleans.lists.BooleanList;
|
||||||
import speiger.src.collections.booleans.lists.BooleanArrayList;
|
import speiger.src.collections.booleans.lists.BooleanArrayList;
|
||||||
@ -16,6 +18,7 @@ import speiger.src.collections.booleans.lists.BooleanArrayList;
|
|||||||
import speiger.src.collections.booleans.lists.BooleanListIterator;
|
import speiger.src.collections.booleans.lists.BooleanListIterator;
|
||||||
import speiger.src.collections.booleans.collections.BooleanBidirectionalIterator;
|
import speiger.src.collections.booleans.collections.BooleanBidirectionalIterator;
|
||||||
import speiger.src.collections.booleans.collections.BooleanCollection;
|
import speiger.src.collections.booleans.collections.BooleanCollection;
|
||||||
|
import speiger.src.collections.booleans.utils.BooleanCollections.CollectionWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Helper class for Iterators
|
* A Helper class for Iterators
|
||||||
@ -206,6 +209,24 @@ public class BooleanIterators
|
|||||||
return new RepeatingIterator(wrap(iterator), repeats);
|
return new RepeatingIterator(wrap(iterator), repeats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper function that creates a infinitely looping iterator
|
||||||
|
* @param iterator that should be looping infinitely
|
||||||
|
* @return a infinitely looping iterator
|
||||||
|
*/
|
||||||
|
public static BooleanIterator infinite(BooleanIterator iterator) {
|
||||||
|
return new InfiniteIterator(iterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper function that creates a infinitely looping iterator from a Java Iterator
|
||||||
|
* @param iterator that should be looping infinitely
|
||||||
|
* @return a infinitely looping iterator
|
||||||
|
*/
|
||||||
|
public static BooleanIterator infinite(Iterator<? extends Boolean> iterator) {
|
||||||
|
return new InfiniteIterator(wrap(iterator));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Helper function that hard limits the Iterator to a specific size
|
* A Helper function that hard limits the Iterator to a specific size
|
||||||
* @param iterator that should be limited
|
* @param iterator that should be limited
|
||||||
@ -841,6 +862,40 @@ public class BooleanIterators
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class InfiniteIterator implements BooleanIterator
|
||||||
|
{
|
||||||
|
BooleanIterator iter;
|
||||||
|
CollectionWrapper looper = BooleanCollections.wrapper();
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
public InfiniteIterator(BooleanIterator iter) {
|
||||||
|
this.iter = iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextBoolean() {
|
||||||
|
if(iter != null) {
|
||||||
|
if(iter.hasNext()) {
|
||||||
|
boolean value = iter.nextBoolean();
|
||||||
|
looper.add(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else iter = null;
|
||||||
|
}
|
||||||
|
return looper.getBoolean((index++) % looper.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEachRemaining(BooleanConsumer action) { throw new UnsupportedOperationException("This is a instant deadlock, so unsupported"); }
|
||||||
|
public void forEachRemaining(Consumer<? super Boolean> action) { throw new UnsupportedOperationException("This is a instant deadlock, so unsupported"); }
|
||||||
|
public <E> void forEachRemaining(E input, ObjectBooleanConsumer<E> action) { throw new UnsupportedOperationException("This is a instant deadlock, so unsupported"); }
|
||||||
|
}
|
||||||
|
|
||||||
private static class RepeatingIterator implements BooleanIterator
|
private static class RepeatingIterator implements BooleanIterator
|
||||||
{
|
{
|
||||||
final int repeats;
|
final int repeats;
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import speiger.src.collections.booleans.collections.BooleanCollection;
|
|||||||
import speiger.src.collections.booleans.functions.BooleanConsumer;
|
import speiger.src.collections.booleans.functions.BooleanConsumer;
|
||||||
import speiger.src.collections.booleans.lists.AbstractBooleanList;
|
import speiger.src.collections.booleans.lists.AbstractBooleanList;
|
||||||
import speiger.src.collections.booleans.lists.BooleanList;
|
import speiger.src.collections.booleans.lists.BooleanList;
|
||||||
|
import speiger.src.collections.ints.lists.IntList;
|
||||||
import speiger.src.collections.booleans.lists.BooleanListIterator;
|
import speiger.src.collections.booleans.lists.BooleanListIterator;
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
|
||||||
@ -313,6 +314,16 @@ public class BooleanLists
|
|||||||
return l.listIterator(index);
|
return l.listIterator(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(int...indecies) {
|
||||||
|
return l.indexedIterator(indecies);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(IntList indecies) {
|
||||||
|
return l.indexedIterator(indecies);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BooleanList subList(int from, int to) {
|
public BooleanList subList(int from, int to) {
|
||||||
return BooleanLists.synchronize(l.subList(from, to));
|
return BooleanLists.synchronize(l.subList(from, to));
|
||||||
@ -420,6 +431,16 @@ public class BooleanLists
|
|||||||
return BooleanIterators.unmodifiable(l.listIterator(index));
|
return BooleanIterators.unmodifiable(l.listIterator(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(int...indecies) {
|
||||||
|
return BooleanIterators.unmodifiable(l.indexedIterator(indecies));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(IntList indecies) {
|
||||||
|
return BooleanIterators.unmodifiable(l.indexedIterator(indecies));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BooleanList subList(int from, int to) {
|
public BooleanList subList(int from, int to) {
|
||||||
return BooleanLists.unmodifiable(l.subList(from, to));
|
return BooleanLists.unmodifiable(l.subList(from, to));
|
||||||
@ -508,6 +529,16 @@ public class BooleanLists
|
|||||||
return BooleanIterators.empty();
|
return BooleanIterators.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(int...indecies) {
|
||||||
|
return BooleanIterators.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanListIterator indexedIterator(IntList indecies) {
|
||||||
|
return BooleanIterators.empty();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() { return 1; }
|
public int hashCode() { return 1; }
|
||||||
|
|
||||||
|
|||||||
@ -89,6 +89,8 @@ public class BooleanPriorityQueues
|
|||||||
@Override
|
@Override
|
||||||
public boolean peek(int index) { synchronized(mutex) { return queue.peek(index); } }
|
public boolean peek(int index) { synchronized(mutex) { return queue.peek(index); } }
|
||||||
@Override
|
@Override
|
||||||
|
public boolean contains(boolean e) { synchronized(mutex) { return queue.contains(e); } }
|
||||||
|
@Override
|
||||||
public boolean removeFirst(boolean e) { synchronized(mutex) { return queue.removeFirst(e); } }
|
public boolean removeFirst(boolean e) { synchronized(mutex) { return queue.removeFirst(e); } }
|
||||||
@Override
|
@Override
|
||||||
public boolean removeLast(boolean e) { synchronized(mutex) { return queue.removeLast(e); } }
|
public boolean removeLast(boolean e) { synchronized(mutex) { return queue.removeLast(e); } }
|
||||||
|
|||||||
@ -8,5 +8,5 @@ public interface ByteSupplier
|
|||||||
/**
|
/**
|
||||||
* @return the supplied value
|
* @return the supplied value
|
||||||
*/
|
*/
|
||||||
public byte getAsInt();
|
public byte getAsByte();
|
||||||
}
|
}
|
||||||
@ -12,6 +12,7 @@ import speiger.src.collections.bytes.collections.AbstractByteCollection;
|
|||||||
import speiger.src.collections.bytes.collections.ByteCollection;
|
import speiger.src.collections.bytes.collections.ByteCollection;
|
||||||
import speiger.src.collections.bytes.collections.ByteIterator;
|
import speiger.src.collections.bytes.collections.ByteIterator;
|
||||||
import speiger.src.collections.bytes.collections.ByteSplititerator;
|
import speiger.src.collections.bytes.collections.ByteSplititerator;
|
||||||
|
import speiger.src.collections.ints.lists.IntList;
|
||||||
import speiger.src.collections.bytes.utils.ByteSplititerators;
|
import speiger.src.collections.bytes.utils.ByteSplititerators;
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
|
||||||
@ -212,6 +213,16 @@ public abstract class AbstractByteList extends AbstractByteCollection implements
|
|||||||
return new ByteListIter(index);
|
return new ByteListIter(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ByteListIterator indexedIterator(int...indecies) {
|
||||||
|
return new IndexedIterator(indecies);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ByteListIterator indexedIterator(IntList indecies) {
|
||||||
|
return new ListIndexedIterator(indecies);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void size(int size) {
|
public void size(int size) {
|
||||||
while(size > size()) add((byte)0);
|
while(size > size()) add((byte)0);
|
||||||
@ -567,6 +578,152 @@ public abstract class AbstractByteList extends AbstractByteCollection implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ListIndexedIterator implements ByteListIterator {
|
||||||
|
IntList indecies;
|
||||||
|
int index;
|
||||||
|
int lastReturned = -1;
|
||||||
|
|
||||||
|
ListIndexedIterator(IntList indecies) {
|
||||||
|
this.indecies = indecies;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return index < indecies.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte nextByte() {
|
||||||
|
if(!hasNext()) throw new NoSuchElementException();
|
||||||
|
int i = index++;
|
||||||
|
return getByte((lastReturned = indecies.getInt(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPrevious() {
|
||||||
|
return index > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte previousByte() {
|
||||||
|
if(!hasPrevious()) throw new NoSuchElementException();
|
||||||
|
index--;
|
||||||
|
return getByte((lastReturned = indecies.getInt(index)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int nextIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int previousIndex() {
|
||||||
|
return index-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public void add(byte e) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(byte e) {
|
||||||
|
if(lastReturned == -1) throw new IllegalStateException();
|
||||||
|
AbstractByteList.this.set(lastReturned, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int skip(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, indecies.size() - index);
|
||||||
|
index += steps;
|
||||||
|
if(steps > 0) lastReturned = Math.min(index-1, indecies.size()-1);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int back(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, index);
|
||||||
|
index -= steps;
|
||||||
|
if(steps > 0) lastReturned = Math.max(index, 0);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class IndexedIterator implements ByteListIterator {
|
||||||
|
int[] indecies;
|
||||||
|
int index;
|
||||||
|
int lastReturned = -1;
|
||||||
|
|
||||||
|
IndexedIterator(int[] indecies) {
|
||||||
|
this.indecies = indecies;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return index < indecies.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte nextByte() {
|
||||||
|
if(!hasNext()) throw new NoSuchElementException();
|
||||||
|
int i = index++;
|
||||||
|
return getByte((lastReturned = indecies[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPrevious() {
|
||||||
|
return index > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte previousByte() {
|
||||||
|
if(!hasPrevious()) throw new NoSuchElementException();
|
||||||
|
index--;
|
||||||
|
return getByte((lastReturned = indecies[index]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int nextIndex() {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int previousIndex() {
|
||||||
|
return index-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove() { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public void add(byte e) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(byte e) {
|
||||||
|
if(lastReturned == -1) throw new IllegalStateException();
|
||||||
|
AbstractByteList.this.set(lastReturned, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int skip(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, indecies.length - index);
|
||||||
|
index += steps;
|
||||||
|
if(steps > 0) lastReturned = Math.min(index-1, indecies.length-1);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int back(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int steps = Math.min(amount, index);
|
||||||
|
index -= steps;
|
||||||
|
if(steps > 0) lastReturned = Math.max(index, 0);
|
||||||
|
return steps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class ByteListIter implements ByteListIterator {
|
private class ByteListIter implements ByteListIterator {
|
||||||
int index;
|
int index;
|
||||||
int lastReturned = -1;
|
int lastReturned = -1;
|
||||||
@ -644,7 +801,7 @@ public abstract class AbstractByteList extends AbstractByteCollection implements
|
|||||||
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
int steps = Math.min(amount, index);
|
int steps = Math.min(amount, index);
|
||||||
index -= steps;
|
index -= steps;
|
||||||
if(steps > 0) lastReturned = Math.min(index, size()-1);
|
if(steps > 0) lastReturned = Math.max(index, 0);
|
||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import speiger.src.collections.ints.functions.consumer.IntByteConsumer;
|
|||||||
import speiger.src.collections.bytes.functions.ByteComparator;
|
import speiger.src.collections.bytes.functions.ByteComparator;
|
||||||
import speiger.src.collections.bytes.utils.ByteArrays;
|
import speiger.src.collections.bytes.utils.ByteArrays;
|
||||||
import speiger.src.collections.bytes.utils.ByteLists;
|
import speiger.src.collections.bytes.utils.ByteLists;
|
||||||
|
import speiger.src.collections.ints.lists.IntList;
|
||||||
import speiger.src.collections.bytes.utils.ByteSplititerators;
|
import speiger.src.collections.bytes.utils.ByteSplititerators;
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
|
||||||
@ -342,6 +343,24 @@ public interface ByteList extends ByteCollection, List<Byte>
|
|||||||
@Override
|
@Override
|
||||||
public ByteListIterator listIterator(int index);
|
public ByteListIterator listIterator(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Iterator that follows the indecies provided.<br>
|
||||||
|
* For example if the Lists Contents is:<br> -1, 0 1 <br>and the indecies are: <br>0, 1, 2, 2, 1, 0<br>
|
||||||
|
* then the iterator will return the following values: <br>-1, 0, 1, 1, 0, -1
|
||||||
|
* @param indecies that should be used for the iteration.
|
||||||
|
* @return a custom indexed iterator
|
||||||
|
*/
|
||||||
|
public ByteListIterator indexedIterator(int...indecies);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Iterator that follows the indecies provided.<br>
|
||||||
|
* For example if the Lists Contents is:<br> -1, 0 1 <br>and the indecies are: <br>0, 1, 2, 2, 1, 0<br>
|
||||||
|
* then the iterator will return the following values: <br>-1, 0, 1, 1, 0, -1
|
||||||
|
* @param indecies that should be used for the iteration.
|
||||||
|
* @return a custom indexed iterator
|
||||||
|
*/
|
||||||
|
public ByteListIterator indexedIterator(IntList indecies);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type-Specific List of subList
|
* A Type-Specific List of subList
|
||||||
* @see java.util.List#subList(int, int)
|
* @see java.util.List#subList(int, int)
|
||||||
|
|||||||
@ -151,6 +151,39 @@ public abstract class AbstractByte2BooleanMap extends AbstractMap<Byte, Boolean>
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
boolean newValue = mappingFunction.test(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
boolean newValue = valueProvider.getAsBoolean();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
boolean newValue = mappingFunction.applyAsBoolean(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -167,17 +200,6 @@ public abstract class AbstractByte2BooleanMap extends AbstractMap<Byte, Boolean>
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
boolean newValue = mappingFunction.test(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -192,17 +214,6 @@ public abstract class AbstractByte2BooleanMap extends AbstractMap<Byte, Boolean>
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
boolean newValue = valueProvider.getAsBoolean();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -217,17 +228,6 @@ public abstract class AbstractByte2BooleanMap extends AbstractMap<Byte, Boolean>
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
boolean newValue = mappingFunction.applyAsBoolean(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -155,6 +155,39 @@ public abstract class AbstractByte2ByteMap extends AbstractMap<Byte, Byte> imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
byte newValue = valueProvider.getAsByte();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -171,17 +204,6 @@ public abstract class AbstractByte2ByteMap extends AbstractMap<Byte, Byte> imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -196,23 +218,12 @@ public abstract class AbstractByte2ByteMap extends AbstractMap<Byte, Byte> imple
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
byte newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
byte value;
|
byte value;
|
||||||
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue != getDefaultReturnValue()) {
|
if(newValue != getDefaultReturnValue()) {
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
@ -221,17 +232,6 @@ public abstract class AbstractByte2ByteMap extends AbstractMap<Byte, Byte> imple
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -157,6 +157,39 @@ public abstract class AbstractByte2CharMap extends AbstractMap<Byte, Character>
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
char newValue = valueProvider.getAsChar();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -173,17 +206,6 @@ public abstract class AbstractByte2CharMap extends AbstractMap<Byte, Character>
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -198,23 +220,12 @@ public abstract class AbstractByte2CharMap extends AbstractMap<Byte, Character>
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
char newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
char value;
|
char value;
|
||||||
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue != getDefaultReturnValue()) {
|
if(newValue != getDefaultReturnValue()) {
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
@ -223,17 +234,6 @@ public abstract class AbstractByte2CharMap extends AbstractMap<Byte, Character>
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -157,6 +157,39 @@ public abstract class AbstractByte2DoubleMap extends AbstractMap<Byte, Double> i
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
double newValue = valueProvider.getAsDouble();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -173,17 +206,6 @@ public abstract class AbstractByte2DoubleMap extends AbstractMap<Byte, Double> i
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -198,17 +220,6 @@ public abstract class AbstractByte2DoubleMap extends AbstractMap<Byte, Double> i
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
double newValue = valueProvider.getAsDouble();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -223,17 +234,6 @@ public abstract class AbstractByte2DoubleMap extends AbstractMap<Byte, Double> i
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -157,6 +157,39 @@ public abstract class AbstractByte2FloatMap extends AbstractMap<Byte, Float> imp
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
float newValue = valueProvider.getAsFloat();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -173,17 +206,6 @@ public abstract class AbstractByte2FloatMap extends AbstractMap<Byte, Float> imp
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -198,23 +220,12 @@ public abstract class AbstractByte2FloatMap extends AbstractMap<Byte, Float> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
float newValue = valueProvider.getAsDouble();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
float value;
|
float value;
|
||||||
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) != Float.floatToIntBits(getDefaultReturnValue())) {
|
if(Float.floatToIntBits(newValue) != Float.floatToIntBits(getDefaultReturnValue())) {
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
@ -223,17 +234,6 @@ public abstract class AbstractByte2FloatMap extends AbstractMap<Byte, Float> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -157,6 +157,39 @@ public abstract class AbstractByte2IntMap extends AbstractMap<Byte, Integer> imp
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
int newValue = valueProvider.getAsInt();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -173,17 +206,6 @@ public abstract class AbstractByte2IntMap extends AbstractMap<Byte, Integer> imp
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -198,17 +220,6 @@ public abstract class AbstractByte2IntMap extends AbstractMap<Byte, Integer> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
int newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -223,17 +234,6 @@ public abstract class AbstractByte2IntMap extends AbstractMap<Byte, Integer> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -157,6 +157,39 @@ public abstract class AbstractByte2LongMap extends AbstractMap<Byte, Long> imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
long newValue = valueProvider.getAsLong();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -173,17 +206,6 @@ public abstract class AbstractByte2LongMap extends AbstractMap<Byte, Long> imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -198,17 +220,6 @@ public abstract class AbstractByte2LongMap extends AbstractMap<Byte, Long> imple
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
long newValue = valueProvider.getAsLong();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -223,17 +234,6 @@ public abstract class AbstractByte2LongMap extends AbstractMap<Byte, Long> imple
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -159,22 +159,6 @@ public abstract class AbstractByte2ObjectMap<V> extends AbstractMap<Byte, V> imp
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
V value = get(key);
|
|
||||||
V newValue = mappingFunction.apply(key, value);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
if(!Objects.equals(value, getDefaultReturnValue()) || containsKey(key)) {
|
|
||||||
remove(key);
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -189,20 +173,6 @@ public abstract class AbstractByte2ObjectMap<V> extends AbstractMap<Byte, V> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
V value;
|
|
||||||
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(!Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -217,20 +187,6 @@ public abstract class AbstractByte2ObjectMap<V> extends AbstractMap<Byte, V> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
V value;
|
|
||||||
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(!Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -246,21 +202,6 @@ public abstract class AbstractByte2ObjectMap<V> extends AbstractMap<Byte, V> imp
|
|||||||
return getDefaultReturnValue();
|
return getDefaultReturnValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
V value;
|
|
||||||
if(!Objects.equals((value = get(key)), getDefaultReturnValue()) || containsKey(key)) {
|
|
||||||
V newValue = mappingFunction.apply(key, value);
|
|
||||||
if(!Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
remove(key);
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -157,6 +157,39 @@ public abstract class AbstractByte2ShortMap extends AbstractMap<Byte, Short> imp
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
if(!containsKey(key)) {
|
||||||
|
short newValue = valueProvider.getAsShort();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
if(containsKey(key)) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key, get(key));
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return getDefaultReturnValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -173,17 +206,6 @@ public abstract class AbstractByte2ShortMap extends AbstractMap<Byte, Short> imp
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -198,23 +220,12 @@ public abstract class AbstractByte2ShortMap extends AbstractMap<Byte, Short> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
if(!containsKey(key)) {
|
|
||||||
short newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
short value;
|
short value;
|
||||||
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
if((value = get(key)) == getDefaultReturnValue() || !containsKey(key)) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue != getDefaultReturnValue()) {
|
if(newValue != getDefaultReturnValue()) {
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
@ -223,17 +234,6 @@ public abstract class AbstractByte2ShortMap extends AbstractMap<Byte, Short> imp
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
if(containsKey(key)) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key, get(key));
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return getDefaultReturnValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -438,13 +438,6 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -452,13 +445,6 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -466,13 +452,6 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -480,6 +459,27 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2032,6 +2032,54 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean computeIfAbsent(int hash, byte key, BytePredicate mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
boolean newValue = mappingFunction.test(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean supplyIfAbsent(int hash, byte key, BooleanSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
boolean newValue = valueProvider.getAsBoolean();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean computeIfPresent(int hash, byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean computeNonDefault(int hash, byte key, ByteBooleanUnaryOperator mappingFunction) {
|
protected boolean computeNonDefault(int hash, byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2055,23 +2103,6 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean computeIfAbsent(int hash, byte key, BytePredicate mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
boolean newValue = mappingFunction.test(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean computeIfAbsentNonDefault(int hash, byte key, BytePredicate mappingFunction) {
|
protected boolean computeIfAbsentNonDefault(int hash, byte key, BytePredicate mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2095,23 +2126,6 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean supplyIfAbsent(int hash, byte key, BooleanSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
boolean newValue = valueProvider.getAsBoolean();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean supplyIfAbsentNonDefault(int hash, byte key, BooleanSupplier valueProvider) {
|
protected boolean supplyIfAbsentNonDefault(int hash, byte key, BooleanSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2135,20 +2149,6 @@ public class Byte2BooleanConcurrentOpenHashMap extends AbstractByte2BooleanMap i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean computeIfPresent(int hash, byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean computeIfPresentNonDefault(int hash, byte key, ByteBooleanUnaryOperator mappingFunction) {
|
protected boolean computeIfPresentNonDefault(int hash, byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -444,13 +444,6 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -458,13 +451,6 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -472,13 +458,6 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -486,6 +465,27 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2069,6 +2069,54 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected byte computeIfAbsent(int hash, byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected byte supplyIfAbsent(int hash, byte key, ByteSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
byte newValue = valueProvider.getAsByte();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected byte computeIfPresent(int hash, byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected byte computeNonDefault(int hash, byte key, ByteByteUnaryOperator mappingFunction) {
|
protected byte computeNonDefault(int hash, byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2092,23 +2140,6 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte computeIfAbsent(int hash, byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected byte computeIfAbsentNonDefault(int hash, byte key, ByteUnaryOperator mappingFunction) {
|
protected byte computeIfAbsentNonDefault(int hash, byte key, ByteUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2132,36 +2163,19 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte supplyIfAbsent(int hash, byte key, ByteSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
byte newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected byte supplyIfAbsentNonDefault(int hash, byte key, ByteSupplier valueProvider) {
|
protected byte supplyIfAbsentNonDefault(int hash, byte key, ByteSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
int index = findIndex(hash, key);
|
int index = findIndex(hash, key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
byte newValue = values[index];
|
byte newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
@ -2172,20 +2186,6 @@ public class Byte2ByteConcurrentOpenHashMap extends AbstractByte2ByteMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected byte computeIfPresent(int hash, byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected byte computeIfPresentNonDefault(int hash, byte key, ByteByteUnaryOperator mappingFunction) {
|
protected byte computeIfPresentNonDefault(int hash, byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -451,13 +451,6 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -465,13 +458,6 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -479,13 +465,6 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,6 +472,27 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2076,6 +2076,54 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected char computeIfAbsent(int hash, byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected char supplyIfAbsent(int hash, byte key, CharSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
char newValue = valueProvider.getAsChar();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected char computeIfPresent(int hash, byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected char computeNonDefault(int hash, byte key, ByteCharUnaryOperator mappingFunction) {
|
protected char computeNonDefault(int hash, byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2099,23 +2147,6 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected char computeIfAbsent(int hash, byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected char computeIfAbsentNonDefault(int hash, byte key, Byte2CharFunction mappingFunction) {
|
protected char computeIfAbsentNonDefault(int hash, byte key, Byte2CharFunction mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2139,36 +2170,19 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected char supplyIfAbsent(int hash, byte key, CharSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
char newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected char supplyIfAbsentNonDefault(int hash, byte key, CharSupplier valueProvider) {
|
protected char supplyIfAbsentNonDefault(int hash, byte key, CharSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
int index = findIndex(hash, key);
|
int index = findIndex(hash, key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
char newValue = values[index];
|
char newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
@ -2179,20 +2193,6 @@ public class Byte2CharConcurrentOpenHashMap extends AbstractByte2CharMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected char computeIfPresent(int hash, byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected char computeIfPresentNonDefault(int hash, byte key, ByteCharUnaryOperator mappingFunction) {
|
protected char computeIfPresentNonDefault(int hash, byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -451,13 +451,6 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -465,13 +458,6 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -479,13 +465,6 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,6 +472,27 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2076,6 +2076,54 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected double computeIfAbsent(int hash, byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected double supplyIfAbsent(int hash, byte key, DoubleSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
double newValue = valueProvider.getAsDouble();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected double computeIfPresent(int hash, byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected double computeNonDefault(int hash, byte key, ByteDoubleUnaryOperator mappingFunction) {
|
protected double computeNonDefault(int hash, byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2099,23 +2147,6 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double computeIfAbsent(int hash, byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected double computeIfAbsentNonDefault(int hash, byte key, Byte2DoubleFunction mappingFunction) {
|
protected double computeIfAbsentNonDefault(int hash, byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2139,23 +2170,6 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double supplyIfAbsent(int hash, byte key, DoubleSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
double newValue = valueProvider.getAsDouble();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected double supplyIfAbsentNonDefault(int hash, byte key, DoubleSupplier valueProvider) {
|
protected double supplyIfAbsentNonDefault(int hash, byte key, DoubleSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2179,20 +2193,6 @@ public class Byte2DoubleConcurrentOpenHashMap extends AbstractByte2DoubleMap imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected double computeIfPresent(int hash, byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected double computeIfPresentNonDefault(int hash, byte key, ByteDoubleUnaryOperator mappingFunction) {
|
protected double computeIfPresentNonDefault(int hash, byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -451,13 +451,6 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -465,13 +458,6 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -479,13 +465,6 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,6 +472,27 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2076,6 +2076,54 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected float computeIfAbsent(int hash, byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float supplyIfAbsent(int hash, byte key, FloatSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
float newValue = valueProvider.getAsFloat();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float computeIfPresent(int hash, byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected float computeNonDefault(int hash, byte key, ByteFloatUnaryOperator mappingFunction) {
|
protected float computeNonDefault(int hash, byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2099,23 +2147,6 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float computeIfAbsent(int hash, byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float computeIfAbsentNonDefault(int hash, byte key, Byte2FloatFunction mappingFunction) {
|
protected float computeIfAbsentNonDefault(int hash, byte key, Byte2FloatFunction mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2139,36 +2170,19 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float supplyIfAbsent(int hash, byte key, FloatSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
float newValue = valueProvider.getAsDouble();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float supplyIfAbsentNonDefault(int hash, byte key, FloatSupplier valueProvider) {
|
protected float supplyIfAbsentNonDefault(int hash, byte key, FloatSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
int index = findIndex(hash, key);
|
int index = findIndex(hash, key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
float newValue = values[index];
|
float newValue = values[index];
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
||||||
newValue = valueProvider.getAsDouble();
|
newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
@ -2179,20 +2193,6 @@ public class Byte2FloatConcurrentOpenHashMap extends AbstractByte2FloatMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float computeIfPresent(int hash, byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected float computeIfPresentNonDefault(int hash, byte key, ByteFloatUnaryOperator mappingFunction) {
|
protected float computeIfPresentNonDefault(int hash, byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -451,13 +451,6 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -465,13 +458,6 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -479,13 +465,6 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,6 +472,27 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2076,6 +2076,54 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int computeIfAbsent(int hash, byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int supplyIfAbsent(int hash, byte key, IntSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
int newValue = valueProvider.getAsInt();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int computeIfPresent(int hash, byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected int computeNonDefault(int hash, byte key, ByteIntUnaryOperator mappingFunction) {
|
protected int computeNonDefault(int hash, byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2099,23 +2147,6 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int computeIfAbsent(int hash, byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int computeIfAbsentNonDefault(int hash, byte key, Byte2IntFunction mappingFunction) {
|
protected int computeIfAbsentNonDefault(int hash, byte key, Byte2IntFunction mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2139,23 +2170,6 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int supplyIfAbsent(int hash, byte key, IntSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
int newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int supplyIfAbsentNonDefault(int hash, byte key, IntSupplier valueProvider) {
|
protected int supplyIfAbsentNonDefault(int hash, byte key, IntSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2179,20 +2193,6 @@ public class Byte2IntConcurrentOpenHashMap extends AbstractByte2IntMap implement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int computeIfPresent(int hash, byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int computeIfPresentNonDefault(int hash, byte key, ByteIntUnaryOperator mappingFunction) {
|
protected int computeIfPresentNonDefault(int hash, byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -451,13 +451,6 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -465,13 +458,6 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -479,13 +465,6 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,6 +472,27 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2076,6 +2076,54 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected long computeIfAbsent(int hash, byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected long supplyIfAbsent(int hash, byte key, LongSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
long newValue = valueProvider.getAsLong();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected long computeIfPresent(int hash, byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected long computeNonDefault(int hash, byte key, ByteLongUnaryOperator mappingFunction) {
|
protected long computeNonDefault(int hash, byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2099,23 +2147,6 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long computeIfAbsent(int hash, byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected long computeIfAbsentNonDefault(int hash, byte key, Byte2LongFunction mappingFunction) {
|
protected long computeIfAbsentNonDefault(int hash, byte key, Byte2LongFunction mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2139,23 +2170,6 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long supplyIfAbsent(int hash, byte key, LongSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
long newValue = valueProvider.getAsLong();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected long supplyIfAbsentNonDefault(int hash, byte key, LongSupplier valueProvider) {
|
protected long supplyIfAbsentNonDefault(int hash, byte key, LongSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2179,20 +2193,6 @@ public class Byte2LongConcurrentOpenHashMap extends AbstractByte2LongMap impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected long computeIfPresent(int hash, byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected long computeIfPresentNonDefault(int hash, byte key, ByteLongUnaryOperator mappingFunction) {
|
protected long computeIfPresentNonDefault(int hash, byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -426,13 +426,6 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -440,13 +433,6 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -454,13 +440,6 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -468,13 +447,6 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfPresentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2011,29 +1983,6 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected V computeNonDefault(int hash, byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = mappingFunction.apply(key, getDefaultReturnValue());
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeIndex(index);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected V computeIfAbsent(int hash, byte key, ByteFunction<V> mappingFunction) {
|
protected V computeIfAbsent(int hash, byte key, ByteFunction<V> mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2057,29 +2006,6 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected V computeIfAbsentNonDefault(int hash, byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected V supplyIfAbsent(int hash, byte key, ObjectSupplier<V> valueProvider) {
|
protected V supplyIfAbsent(int hash, byte key, ObjectSupplier<V> valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2103,29 +2029,6 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected V supplyIfAbsentNonDefault(int hash, byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected V computeIfPresent(int hash, byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
protected V computeIfPresent(int hash, byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2144,11 +2047,16 @@ public class Byte2ObjectConcurrentOpenHashMap<V> extends AbstractByte2ObjectMap<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected V computeIfPresentNonDefault(int hash, byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
protected V computeNonDefault(int hash, byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
int index = findIndex(hash, key);
|
int index = findIndex(hash, key);
|
||||||
if(index < 0 || Objects.equals(values[index], getDefaultReturnValue())) return getDefaultReturnValue();
|
if(index < 0) {
|
||||||
|
V newValue = mappingFunction.apply(key, getDefaultReturnValue());
|
||||||
|
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
V newValue = mappingFunction.apply(key, values[index]);
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
||||||
removeIndex(index);
|
removeIndex(index);
|
||||||
|
|||||||
@ -451,13 +451,6 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
return getSegment(hash).compute(hash, key, mappingFunction);
|
return getSegment(hash).compute(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -465,13 +458,6 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfAbsent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -479,13 +465,6 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
return getSegment(hash).supplyIfAbsent(hash, key, valueProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int hash = getHashCode(key);
|
|
||||||
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,6 +472,27 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
return getSegment(hash).computeIfPresent(hash, key, mappingFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).computeIfAbsentNonDefault(hash, key, mappingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int hash = getHashCode(key);
|
||||||
|
return getSegment(hash).supplyIfAbsentNonDefault(hash, key, valueProvider);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -2076,6 +2076,54 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected short computeIfAbsent(int hash, byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected short supplyIfAbsent(int hash, byte key, ShortSupplier valueProvider) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) {
|
||||||
|
short newValue = valueProvider.getAsShort();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected short computeIfPresent(int hash, byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
long stamp = writeLock();
|
||||||
|
try {
|
||||||
|
int index = findIndex(hash, key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
unlockWrite(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected short computeNonDefault(int hash, byte key, ByteShortUnaryOperator mappingFunction) {
|
protected short computeNonDefault(int hash, byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2099,23 +2147,6 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected short computeIfAbsent(int hash, byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected short computeIfAbsentNonDefault(int hash, byte key, Byte2ShortFunction mappingFunction) {
|
protected short computeIfAbsentNonDefault(int hash, byte key, Byte2ShortFunction mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
@ -2139,36 +2170,19 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected short supplyIfAbsent(int hash, byte key, ShortSupplier valueProvider) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) {
|
|
||||||
short newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected short supplyIfAbsentNonDefault(int hash, byte key, ShortSupplier valueProvider) {
|
protected short supplyIfAbsentNonDefault(int hash, byte key, ShortSupplier valueProvider) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
int index = findIndex(hash, key);
|
int index = findIndex(hash, key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
short newValue = values[index];
|
short newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
@ -2179,20 +2193,6 @@ public class Byte2ShortConcurrentOpenHashMap extends AbstractByte2ShortMap imple
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected short computeIfPresent(int hash, byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
long stamp = writeLock();
|
|
||||||
try {
|
|
||||||
int index = findIndex(hash, key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
unlockWrite(stamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected short computeIfPresentNonDefault(int hash, byte key, ByteShortUnaryOperator mappingFunction) {
|
protected short computeIfPresentNonDefault(int hash, byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
long stamp = writeLock();
|
long stamp = writeLock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -440,6 +440,42 @@ public class Byte2BooleanOpenCustomHashMap extends AbstractByte2BooleanMap imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
boolean newValue = mappingFunction.test(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
boolean newValue = valueProvider.getAsBoolean();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -459,19 +495,6 @@ public class Byte2BooleanOpenCustomHashMap extends AbstractByte2BooleanMap imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
boolean newValue = mappingFunction.test(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -491,19 +514,6 @@ public class Byte2BooleanOpenCustomHashMap extends AbstractByte2BooleanMap imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
boolean newValue = valueProvider.getAsBoolean();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -523,16 +533,6 @@ public class Byte2BooleanOpenCustomHashMap extends AbstractByte2BooleanMap imple
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -454,6 +454,42 @@ public class Byte2ByteOpenCustomHashMap extends AbstractByte2ByteMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
byte newValue = valueProvider.getAsByte();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -473,19 +509,6 @@ public class Byte2ByteOpenCustomHashMap extends AbstractByte2ByteMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -505,48 +528,25 @@ public class Byte2ByteOpenCustomHashMap extends AbstractByte2ByteMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
byte newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
byte newValue = values[index];
|
byte newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -462,6 +462,42 @@ public class Byte2CharOpenCustomHashMap extends AbstractByte2CharMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
char newValue = valueProvider.getAsChar();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -481,19 +517,6 @@ public class Byte2CharOpenCustomHashMap extends AbstractByte2CharMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -513,48 +536,25 @@ public class Byte2CharOpenCustomHashMap extends AbstractByte2CharMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
char newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
char newValue = values[index];
|
char newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -462,6 +462,42 @@ public class Byte2DoubleOpenCustomHashMap extends AbstractByte2DoubleMap impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
double newValue = valueProvider.getAsDouble();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -481,19 +517,6 @@ public class Byte2DoubleOpenCustomHashMap extends AbstractByte2DoubleMap impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -513,19 +536,6 @@ public class Byte2DoubleOpenCustomHashMap extends AbstractByte2DoubleMap impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
double newValue = valueProvider.getAsDouble();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -545,16 +555,6 @@ public class Byte2DoubleOpenCustomHashMap extends AbstractByte2DoubleMap impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -462,6 +462,42 @@ public class Byte2FloatOpenCustomHashMap extends AbstractByte2FloatMap implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
float newValue = valueProvider.getAsFloat();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -481,19 +517,6 @@ public class Byte2FloatOpenCustomHashMap extends AbstractByte2FloatMap implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -513,48 +536,25 @@ public class Byte2FloatOpenCustomHashMap extends AbstractByte2FloatMap implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
float newValue = valueProvider.getAsDouble();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
float newValue = values[index];
|
float newValue = values[index];
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
||||||
newValue = valueProvider.getAsDouble();
|
newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -462,6 +462,42 @@ public class Byte2IntOpenCustomHashMap extends AbstractByte2IntMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
int newValue = valueProvider.getAsInt();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -481,19 +517,6 @@ public class Byte2IntOpenCustomHashMap extends AbstractByte2IntMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -513,19 +536,6 @@ public class Byte2IntOpenCustomHashMap extends AbstractByte2IntMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
int newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -545,16 +555,6 @@ public class Byte2IntOpenCustomHashMap extends AbstractByte2IntMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -462,6 +462,42 @@ public class Byte2LongOpenCustomHashMap extends AbstractByte2LongMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
long newValue = valueProvider.getAsLong();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -481,19 +517,6 @@ public class Byte2LongOpenCustomHashMap extends AbstractByte2LongMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -513,19 +536,6 @@ public class Byte2LongOpenCustomHashMap extends AbstractByte2LongMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
long newValue = valueProvider.getAsLong();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -545,16 +555,6 @@ public class Byte2LongOpenCustomHashMap extends AbstractByte2LongMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -432,25 +432,6 @@ public class Byte2ObjectOpenCustomHashMap<V> extends AbstractByte2ObjectMap<V> i
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = mappingFunction.apply(key, getDefaultReturnValue());
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeIndex(index);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -470,25 +451,6 @@ public class Byte2ObjectOpenCustomHashMap<V> extends AbstractByte2ObjectMap<V> i
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -508,25 +470,6 @@ public class Byte2ObjectOpenCustomHashMap<V> extends AbstractByte2ObjectMap<V> i
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -541,20 +484,6 @@ public class Byte2ObjectOpenCustomHashMap<V> extends AbstractByte2ObjectMap<V> i
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0 || Objects.equals(values[index], getDefaultReturnValue())) return getDefaultReturnValue();
|
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeIndex(index);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -462,6 +462,42 @@ public class Byte2ShortOpenCustomHashMap extends AbstractByte2ShortMap implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
short newValue = valueProvider.getAsShort();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -481,19 +517,6 @@ public class Byte2ShortOpenCustomHashMap extends AbstractByte2ShortMap implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -513,48 +536,25 @@ public class Byte2ShortOpenCustomHashMap extends AbstractByte2ShortMap implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
short newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
short newValue = values[index];
|
short newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -409,6 +409,42 @@ public class Byte2BooleanOpenHashMap extends AbstractByte2BooleanMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
boolean newValue = mappingFunction.test(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
boolean newValue = valueProvider.getAsBoolean();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -428,19 +464,6 @@ public class Byte2BooleanOpenHashMap extends AbstractByte2BooleanMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
boolean newValue = mappingFunction.test(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -460,19 +483,6 @@ public class Byte2BooleanOpenHashMap extends AbstractByte2BooleanMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
boolean newValue = valueProvider.getAsBoolean();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -492,16 +502,6 @@ public class Byte2BooleanOpenHashMap extends AbstractByte2BooleanMap implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -425,6 +425,42 @@ public class Byte2ByteOpenHashMap extends AbstractByte2ByteMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
byte newValue = valueProvider.getAsByte();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -444,19 +480,6 @@ public class Byte2ByteOpenHashMap extends AbstractByte2ByteMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -476,48 +499,25 @@ public class Byte2ByteOpenHashMap extends AbstractByte2ByteMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
byte newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
byte newValue = values[index];
|
byte newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -431,6 +431,42 @@ public class Byte2CharOpenHashMap extends AbstractByte2CharMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
char newValue = valueProvider.getAsChar();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -450,19 +486,6 @@ public class Byte2CharOpenHashMap extends AbstractByte2CharMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -482,48 +505,25 @@ public class Byte2CharOpenHashMap extends AbstractByte2CharMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
char newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
char newValue = values[index];
|
char newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -431,6 +431,42 @@ public class Byte2DoubleOpenHashMap extends AbstractByte2DoubleMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
double newValue = valueProvider.getAsDouble();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -450,19 +486,6 @@ public class Byte2DoubleOpenHashMap extends AbstractByte2DoubleMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -482,19 +505,6 @@ public class Byte2DoubleOpenHashMap extends AbstractByte2DoubleMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
double newValue = valueProvider.getAsDouble();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -514,16 +524,6 @@ public class Byte2DoubleOpenHashMap extends AbstractByte2DoubleMap implements IT
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -431,6 +431,42 @@ public class Byte2FloatOpenHashMap extends AbstractByte2FloatMap implements ITri
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
float newValue = valueProvider.getAsFloat();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -450,19 +486,6 @@ public class Byte2FloatOpenHashMap extends AbstractByte2FloatMap implements ITri
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -482,48 +505,25 @@ public class Byte2FloatOpenHashMap extends AbstractByte2FloatMap implements ITri
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
float newValue = valueProvider.getAsDouble();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
float newValue = values[index];
|
float newValue = values[index];
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
||||||
newValue = valueProvider.getAsDouble();
|
newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -431,6 +431,42 @@ public class Byte2IntOpenHashMap extends AbstractByte2IntMap implements ITrimmab
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
int newValue = valueProvider.getAsInt();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -450,19 +486,6 @@ public class Byte2IntOpenHashMap extends AbstractByte2IntMap implements ITrimmab
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -482,19 +505,6 @@ public class Byte2IntOpenHashMap extends AbstractByte2IntMap implements ITrimmab
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
int newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -514,16 +524,6 @@ public class Byte2IntOpenHashMap extends AbstractByte2IntMap implements ITrimmab
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -431,6 +431,42 @@ public class Byte2LongOpenHashMap extends AbstractByte2LongMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
long newValue = valueProvider.getAsLong();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -450,19 +486,6 @@ public class Byte2LongOpenHashMap extends AbstractByte2LongMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -482,19 +505,6 @@ public class Byte2LongOpenHashMap extends AbstractByte2LongMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
long newValue = valueProvider.getAsLong();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -514,16 +524,6 @@ public class Byte2LongOpenHashMap extends AbstractByte2LongMap implements ITrimm
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -402,25 +402,6 @@ public class Byte2ObjectOpenHashMap<V> extends AbstractByte2ObjectMap<V> impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = mappingFunction.apply(key, getDefaultReturnValue());
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeIndex(index);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -440,25 +421,6 @@ public class Byte2ObjectOpenHashMap<V> extends AbstractByte2ObjectMap<V> impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -478,25 +440,6 @@ public class Byte2ObjectOpenHashMap<V> extends AbstractByte2ObjectMap<V> impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -511,20 +454,6 @@ public class Byte2ObjectOpenHashMap<V> extends AbstractByte2ObjectMap<V> impleme
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0 || Objects.equals(values[index], getDefaultReturnValue())) return getDefaultReturnValue();
|
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeIndex(index);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -431,6 +431,42 @@ public class Byte2ShortOpenHashMap extends AbstractByte2ShortMap implements ITri
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key);
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) {
|
||||||
|
short newValue = valueProvider.getAsShort();
|
||||||
|
insert(-index-1, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index < 0) return getDefaultReturnValue();
|
||||||
|
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -450,19 +486,6 @@ public class Byte2ShortOpenHashMap extends AbstractByte2ShortMap implements ITri
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key);
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -482,48 +505,25 @@ public class Byte2ShortOpenHashMap extends AbstractByte2ShortMap implements ITri
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) {
|
|
||||||
short newValue = valueProvider.getAsInt();
|
|
||||||
insert(-index-1, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index < 0) {
|
if(index < 0) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insert(-index-1, key, newValue);
|
insert(-index-1, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
short newValue = values[index];
|
short newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index < 0) return getDefaultReturnValue();
|
|
||||||
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -413,20 +413,19 @@ public class ImmutableByte2BooleanOpenHashMap extends AbstractByte2BooleanMap im
|
|||||||
@Override
|
@Override
|
||||||
public boolean computeBoolean(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public boolean computeBoolean(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) { throw new UnsupportedOperationException(); }
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mergeBoolean(byte key, boolean value, BooleanBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public boolean mergeBoolean(byte key, boolean value, BooleanBooleanUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -409,20 +409,19 @@ public class ImmutableByte2ByteOpenHashMap extends AbstractByte2ByteMap implemen
|
|||||||
@Override
|
@Override
|
||||||
public byte computeByte(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public byte computeByte(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte mergeByte(byte key, byte value, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public byte mergeByte(byte key, byte value, ByteByteUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -418,20 +418,19 @@ public class ImmutableByte2CharOpenHashMap extends AbstractByte2CharMap implemen
|
|||||||
@Override
|
@Override
|
||||||
public char computeChar(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public char computeChar(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char mergeChar(byte key, char value, CharCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public char mergeChar(byte key, char value, CharCharUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -418,20 +418,19 @@ public class ImmutableByte2DoubleOpenHashMap extends AbstractByte2DoubleMap impl
|
|||||||
@Override
|
@Override
|
||||||
public double computeDouble(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public double computeDouble(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double mergeDouble(byte key, double value, DoubleDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public double mergeDouble(byte key, double value, DoubleDoubleUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -418,20 +418,19 @@ public class ImmutableByte2FloatOpenHashMap extends AbstractByte2FloatMap implem
|
|||||||
@Override
|
@Override
|
||||||
public float computeFloat(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public float computeFloat(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float mergeFloat(byte key, float value, FloatFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public float mergeFloat(byte key, float value, FloatFloatUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -418,20 +418,19 @@ public class ImmutableByte2IntOpenHashMap extends AbstractByte2IntMap implements
|
|||||||
@Override
|
@Override
|
||||||
public int computeInt(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public int computeInt(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int mergeInt(byte key, int value, IntIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public int mergeInt(byte key, int value, IntIntUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -418,20 +418,19 @@ public class ImmutableByte2LongOpenHashMap extends AbstractByte2LongMap implemen
|
|||||||
@Override
|
@Override
|
||||||
public long computeLong(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public long computeLong(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long mergeLong(byte key, long value, LongLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public long mergeLong(byte key, long value, LongLongUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -397,20 +397,11 @@ public class ImmutableByte2ObjectOpenHashMap<V> extends AbstractByte2ObjectMap<V
|
|||||||
@Override
|
@Override
|
||||||
public V compute(byte key, ByteObjectUnaryOperator<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
public V compute(byte key, ByteObjectUnaryOperator<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) { throw new UnsupportedOperationException(); }
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) { throw new UnsupportedOperationException(); }
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -418,20 +418,19 @@ public class ImmutableByte2ShortOpenHashMap extends AbstractByte2ShortMap implem
|
|||||||
@Override
|
@Override
|
||||||
public short computeShort(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public short computeShort(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
|
||||||
@Override
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) { throw new UnsupportedOperationException(); }
|
||||||
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short mergeShort(byte key, short value, ShortShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
public short mergeShort(byte key, short value, ShortShortUnaryOperator mappingFunction) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
|
|||||||
@ -419,6 +419,42 @@ public class Byte2BooleanArrayMap extends AbstractByte2BooleanMap implements Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
boolean newValue = mappingFunction.test(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
boolean newValue = valueProvider.getAsBoolean();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
boolean newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -438,19 +474,6 @@ public class Byte2BooleanArrayMap extends AbstractByte2BooleanMap implements Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
boolean newValue = mappingFunction.test(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -470,19 +493,6 @@ public class Byte2BooleanArrayMap extends AbstractByte2BooleanMap implements Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
boolean newValue = valueProvider.getAsBoolean();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
boolean newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -502,16 +512,6 @@ public class Byte2BooleanArrayMap extends AbstractByte2BooleanMap implements Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
boolean newValue = mappingFunction.applyAsBoolean(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -435,6 +435,42 @@ public class Byte2ByteArrayMap extends AbstractByte2ByteMap implements Byte2Byte
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
byte newValue = valueProvider.getAsByte();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
byte newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -454,19 +490,6 @@ public class Byte2ByteArrayMap extends AbstractByte2ByteMap implements Byte2Byte
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -486,48 +509,25 @@ public class Byte2ByteArrayMap extends AbstractByte2ByteMap implements Byte2Byte
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
byte newValue = valueProvider.getAsInt();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
byte newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index == -1) {
|
if(index == -1) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insertIndex(size++, key, newValue);
|
insertIndex(size++, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
byte newValue = values[index];
|
byte newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -442,6 +442,42 @@ public class Byte2CharArrayMap extends AbstractByte2CharMap implements Byte2Char
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
char newValue = valueProvider.getAsChar();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
char newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -461,19 +497,6 @@ public class Byte2CharArrayMap extends AbstractByte2CharMap implements Byte2Char
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,48 +516,25 @@ public class Byte2CharArrayMap extends AbstractByte2CharMap implements Byte2Char
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
char newValue = valueProvider.getAsInt();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
char newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index == -1) {
|
if(index == -1) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insertIndex(size++, key, newValue);
|
insertIndex(size++, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
char newValue = values[index];
|
char newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
char newValue = mappingFunction.applyAsChar(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -442,6 +442,42 @@ public class Byte2DoubleArrayMap extends AbstractByte2DoubleMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
double newValue = valueProvider.getAsDouble();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
double newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -461,19 +497,6 @@ public class Byte2DoubleArrayMap extends AbstractByte2DoubleMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,19 +516,6 @@ public class Byte2DoubleArrayMap extends AbstractByte2DoubleMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
double newValue = valueProvider.getAsDouble();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
double newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -525,16 +535,6 @@ public class Byte2DoubleArrayMap extends AbstractByte2DoubleMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -442,6 +442,42 @@ public class Byte2FloatArrayMap extends AbstractByte2FloatMap implements Byte2Fl
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
float newValue = valueProvider.getAsFloat();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
float newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -461,19 +497,6 @@ public class Byte2FloatArrayMap extends AbstractByte2FloatMap implements Byte2Fl
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,48 +516,25 @@ public class Byte2FloatArrayMap extends AbstractByte2FloatMap implements Byte2Fl
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
float newValue = valueProvider.getAsDouble();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
float newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index == -1) {
|
if(index == -1) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
insertIndex(size++, key, newValue);
|
insertIndex(size++, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
float newValue = values[index];
|
float newValue = values[index];
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
||||||
newValue = valueProvider.getAsDouble();
|
newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -442,6 +442,42 @@ public class Byte2IntArrayMap extends AbstractByte2IntMap implements Byte2IntOrd
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
int newValue = valueProvider.getAsInt();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
int newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -461,19 +497,6 @@ public class Byte2IntArrayMap extends AbstractByte2IntMap implements Byte2IntOrd
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,19 +516,6 @@ public class Byte2IntArrayMap extends AbstractByte2IntMap implements Byte2IntOrd
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
int newValue = valueProvider.getAsInt();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
int newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -525,16 +535,6 @@ public class Byte2IntArrayMap extends AbstractByte2IntMap implements Byte2IntOrd
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
int newValue = mappingFunction.applyAsInt(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -442,6 +442,42 @@ public class Byte2LongArrayMap extends AbstractByte2LongMap implements Byte2Long
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
long newValue = valueProvider.getAsLong();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
long newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -461,19 +497,6 @@ public class Byte2LongArrayMap extends AbstractByte2LongMap implements Byte2Long
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,19 +516,6 @@ public class Byte2LongArrayMap extends AbstractByte2LongMap implements Byte2Long
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
long newValue = valueProvider.getAsLong();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
long newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -525,16 +535,6 @@ public class Byte2LongArrayMap extends AbstractByte2LongMap implements Byte2Long
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
long newValue = mappingFunction.applyAsLong(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -415,25 +415,6 @@ public class Byte2ObjectArrayMap<V> extends AbstractByte2ObjectMap<V> implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
V newValue = mappingFunction.apply(key, getDefaultReturnValue());
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeIndex(index);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -453,25 +434,6 @@ public class Byte2ObjectArrayMap<V> extends AbstractByte2ObjectMap<V> implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -491,25 +453,6 @@ public class Byte2ObjectArrayMap<V> extends AbstractByte2ObjectMap<V> implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = values[index];
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
values[index] = newValue;
|
|
||||||
}
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -524,20 +467,6 @@ public class Byte2ObjectArrayMap<V> extends AbstractByte2ObjectMap<V> implements
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1 || Objects.equals(values[index], getDefaultReturnValue())) return getDefaultReturnValue();
|
|
||||||
V newValue = mappingFunction.apply(key, values[index]);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeIndex(index);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -442,6 +442,42 @@ public class Byte2ShortArrayMap extends AbstractByte2ShortMap implements Byte2Sh
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key);
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) {
|
||||||
|
short newValue = valueProvider.getAsShort();
|
||||||
|
insertIndex(size++, key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
short newValue = values[index];
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
int index = findIndex(key);
|
||||||
|
if(index == -1) return getDefaultReturnValue();
|
||||||
|
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -461,19 +497,6 @@ public class Byte2ShortArrayMap extends AbstractByte2ShortMap implements Byte2Sh
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key);
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -493,48 +516,25 @@ public class Byte2ShortArrayMap extends AbstractByte2ShortMap implements Byte2Sh
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) {
|
|
||||||
short newValue = valueProvider.getAsInt();
|
|
||||||
insertIndex(size++, key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
short newValue = values[index];
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
int index = findIndex(key);
|
int index = findIndex(key);
|
||||||
if(index == -1) {
|
if(index == -1) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
insertIndex(size++, key, newValue);
|
insertIndex(size++, key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
short newValue = values[index];
|
short newValue = values[index];
|
||||||
if(newValue == getDefaultReturnValue()) {
|
if(newValue == getDefaultReturnValue()) {
|
||||||
newValue = valueProvider.getAsInt();
|
newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
values[index] = newValue;
|
values[index] = newValue;
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
int index = findIndex(key);
|
|
||||||
if(index == -1) return getDefaultReturnValue();
|
|
||||||
short newValue = mappingFunction.applyAsShort(key, values[index]);
|
|
||||||
values[index] = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -395,6 +395,40 @@ public class Byte2BooleanAVLTreeMap extends AbstractByte2BooleanMap implements B
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
boolean newValue = mappingFunction.test(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
boolean newValue = valueProvider.getAsBoolean();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
boolean newValue = mappingFunction.applyAsBoolean(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -414,18 +448,6 @@ public class Byte2BooleanAVLTreeMap extends AbstractByte2BooleanMap implements B
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
boolean newValue = mappingFunction.test(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -444,18 +466,6 @@ public class Byte2BooleanAVLTreeMap extends AbstractByte2BooleanMap implements B
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
boolean newValue = valueProvider.getAsBoolean();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -474,16 +484,6 @@ public class Byte2BooleanAVLTreeMap extends AbstractByte2BooleanMap implements B
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
boolean newValue = mappingFunction.applyAsBoolean(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1487,14 +1487,9 @@ public class Byte2BooleanAVLTreeMap extends AbstractByte2BooleanMap implements B
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
boolean newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -394,6 +394,40 @@ public class Byte2BooleanRBTreeMap extends AbstractByte2BooleanMap implements By
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
boolean newValue = mappingFunction.test(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
boolean newValue = valueProvider.getAsBoolean();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
boolean newValue = mappingFunction.applyAsBoolean(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -413,18 +447,6 @@ public class Byte2BooleanRBTreeMap extends AbstractByte2BooleanMap implements By
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
boolean newValue = mappingFunction.test(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -443,18 +465,6 @@ public class Byte2BooleanRBTreeMap extends AbstractByte2BooleanMap implements By
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
boolean newValue = valueProvider.getAsBoolean();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -473,16 +483,6 @@ public class Byte2BooleanRBTreeMap extends AbstractByte2BooleanMap implements By
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
boolean newValue = mappingFunction.applyAsBoolean(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
public boolean computeBooleanIfPresentNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1550,14 +1550,9 @@ public class Byte2BooleanRBTreeMap extends AbstractByte2BooleanMap implements By
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
boolean newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -446,6 +446,40 @@ public class Byte2ByteAVLTreeMap extends AbstractByte2ByteMap implements Byte2By
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
byte newValue = valueProvider.getAsByte();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -465,18 +499,6 @@ public class Byte2ByteAVLTreeMap extends AbstractByte2ByteMap implements Byte2By
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -495,46 +517,24 @@ public class Byte2ByteAVLTreeMap extends AbstractByte2ByteMap implements Byte2By
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
byte newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(entry.value == getDefaultReturnValue()) {
|
if(entry.value == getDefaultReturnValue()) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1550,14 +1550,9 @@ public class Byte2ByteAVLTreeMap extends AbstractByte2ByteMap implements Byte2By
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
byte newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -445,6 +445,40 @@ public class Byte2ByteRBTreeMap extends AbstractByte2ByteMap implements Byte2Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
byte newValue = valueProvider.getAsByte();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
byte newValue = mappingFunction.applyAsByte(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -464,18 +498,6 @@ public class Byte2ByteRBTreeMap extends AbstractByte2ByteMap implements Byte2Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -494,46 +516,24 @@ public class Byte2ByteRBTreeMap extends AbstractByte2ByteMap implements Byte2Byt
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
byte newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(entry.value == getDefaultReturnValue()) {
|
if(entry.value == getDefaultReturnValue()) {
|
||||||
byte newValue = valueProvider.getAsInt();
|
byte newValue = valueProvider.getAsByte();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
byte newValue = mappingFunction.applyAsByte(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
public byte computeByteIfPresentNonDefault(byte key, ByteByteUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1613,14 +1613,9 @@ public class Byte2ByteRBTreeMap extends AbstractByte2ByteMap implements Byte2Byt
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
byte newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -454,6 +454,40 @@ public class Byte2CharAVLTreeMap extends AbstractByte2CharMap implements Byte2Ch
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
char newValue = valueProvider.getAsChar();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
char newValue = mappingFunction.applyAsChar(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -473,18 +507,6 @@ public class Byte2CharAVLTreeMap extends AbstractByte2CharMap implements Byte2Ch
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -503,46 +525,24 @@ public class Byte2CharAVLTreeMap extends AbstractByte2CharMap implements Byte2Ch
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
char newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(entry.value == getDefaultReturnValue()) {
|
if(entry.value == getDefaultReturnValue()) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
char newValue = mappingFunction.applyAsChar(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1558,14 +1558,9 @@ public class Byte2CharAVLTreeMap extends AbstractByte2CharMap implements Byte2Ch
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
char newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -453,6 +453,40 @@ public class Byte2CharRBTreeMap extends AbstractByte2CharMap implements Byte2Cha
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
char newValue = mappingFunction.applyAsChar(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
char newValue = valueProvider.getAsChar();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
char newValue = mappingFunction.applyAsChar(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -472,18 +506,6 @@ public class Byte2CharRBTreeMap extends AbstractByte2CharMap implements Byte2Cha
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
char newValue = mappingFunction.applyAsChar(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -502,46 +524,24 @@ public class Byte2CharRBTreeMap extends AbstractByte2CharMap implements Byte2Cha
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
char newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(entry.value == getDefaultReturnValue()) {
|
if(entry.value == getDefaultReturnValue()) {
|
||||||
char newValue = valueProvider.getAsInt();
|
char newValue = valueProvider.getAsChar();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
char newValue = mappingFunction.applyAsChar(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
public char computeCharIfPresentNonDefault(byte key, ByteCharUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1621,14 +1621,9 @@ public class Byte2CharRBTreeMap extends AbstractByte2CharMap implements Byte2Cha
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
char newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -454,6 +454,40 @@ public class Byte2DoubleAVLTreeMap extends AbstractByte2DoubleMap implements Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
double newValue = valueProvider.getAsDouble();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -473,18 +507,6 @@ public class Byte2DoubleAVLTreeMap extends AbstractByte2DoubleMap implements Byt
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -503,18 +525,6 @@ public class Byte2DoubleAVLTreeMap extends AbstractByte2DoubleMap implements Byt
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
double newValue = valueProvider.getAsDouble();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -533,16 +543,6 @@ public class Byte2DoubleAVLTreeMap extends AbstractByte2DoubleMap implements Byt
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1558,14 +1558,9 @@ public class Byte2DoubleAVLTreeMap extends AbstractByte2DoubleMap implements Byt
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || Double.doubleToLongBits(entry.value) == Double.doubleToLongBits(getDefaultReturnValue())) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
double newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(Double.doubleToLongBits(newValue) == Double.doubleToLongBits(getDefaultReturnValue())) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -453,6 +453,40 @@ public class Byte2DoubleRBTreeMap extends AbstractByte2DoubleMap implements Byte
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
double newValue = valueProvider.getAsDouble();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
double newValue = mappingFunction.applyAsDouble(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -472,18 +506,6 @@ public class Byte2DoubleRBTreeMap extends AbstractByte2DoubleMap implements Byte
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -502,18 +524,6 @@ public class Byte2DoubleRBTreeMap extends AbstractByte2DoubleMap implements Byte
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
double newValue = valueProvider.getAsDouble();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -532,16 +542,6 @@ public class Byte2DoubleRBTreeMap extends AbstractByte2DoubleMap implements Byte
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
double newValue = mappingFunction.applyAsDouble(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
public double computeDoubleIfPresentNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1621,14 +1621,9 @@ public class Byte2DoubleRBTreeMap extends AbstractByte2DoubleMap implements Byte
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || Double.doubleToLongBits(entry.value) == Double.doubleToLongBits(getDefaultReturnValue())) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
double newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(Double.doubleToLongBits(newValue) == Double.doubleToLongBits(getDefaultReturnValue())) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -454,6 +454,40 @@ public class Byte2FloatAVLTreeMap extends AbstractByte2FloatMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
float newValue = valueProvider.getAsFloat();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -473,18 +507,6 @@ public class Byte2FloatAVLTreeMap extends AbstractByte2FloatMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -503,46 +525,24 @@ public class Byte2FloatAVLTreeMap extends AbstractByte2FloatMap implements Byte2
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
float newValue = valueProvider.getAsDouble();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(Float.floatToIntBits(entry.value) == Float.floatToIntBits(getDefaultReturnValue())) {
|
if(Float.floatToIntBits(entry.value) == Float.floatToIntBits(getDefaultReturnValue())) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1558,14 +1558,9 @@ public class Byte2FloatAVLTreeMap extends AbstractByte2FloatMap implements Byte2
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || Float.floatToIntBits(entry.value) == Float.floatToIntBits(getDefaultReturnValue())) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
float newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -453,6 +453,40 @@ public class Byte2FloatRBTreeMap extends AbstractByte2FloatMap implements Byte2F
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
float newValue = valueProvider.getAsFloat();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
float newValue = mappingFunction.applyAsFloat(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -472,18 +506,6 @@ public class Byte2FloatRBTreeMap extends AbstractByte2FloatMap implements Byte2F
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -502,46 +524,24 @@ public class Byte2FloatRBTreeMap extends AbstractByte2FloatMap implements Byte2F
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
float newValue = valueProvider.getAsDouble();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(Float.floatToIntBits(entry.value) == Float.floatToIntBits(getDefaultReturnValue())) {
|
if(Float.floatToIntBits(entry.value) == Float.floatToIntBits(getDefaultReturnValue())) {
|
||||||
float newValue = valueProvider.getAsDouble();
|
float newValue = valueProvider.getAsFloat();
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
float newValue = mappingFunction.applyAsFloat(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
public float computeFloatIfPresentNonDefault(byte key, ByteFloatUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1621,14 +1621,9 @@ public class Byte2FloatRBTreeMap extends AbstractByte2FloatMap implements Byte2F
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || Float.floatToIntBits(entry.value) == Float.floatToIntBits(getDefaultReturnValue())) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
float newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(Float.floatToIntBits(newValue) == Float.floatToIntBits(getDefaultReturnValue())) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -454,6 +454,40 @@ public class Byte2IntAVLTreeMap extends AbstractByte2IntMap implements Byte2IntN
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
int newValue = valueProvider.getAsInt();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
int newValue = mappingFunction.applyAsInt(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -473,18 +507,6 @@ public class Byte2IntAVLTreeMap extends AbstractByte2IntMap implements Byte2IntN
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -503,18 +525,6 @@ public class Byte2IntAVLTreeMap extends AbstractByte2IntMap implements Byte2IntN
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
int newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -533,16 +543,6 @@ public class Byte2IntAVLTreeMap extends AbstractByte2IntMap implements Byte2IntN
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
int newValue = mappingFunction.applyAsInt(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1558,14 +1558,9 @@ public class Byte2IntAVLTreeMap extends AbstractByte2IntMap implements Byte2IntN
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
int newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -453,6 +453,40 @@ public class Byte2IntRBTreeMap extends AbstractByte2IntMap implements Byte2IntNa
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
int newValue = mappingFunction.applyAsInt(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
int newValue = valueProvider.getAsInt();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
int newValue = mappingFunction.applyAsInt(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -472,18 +506,6 @@ public class Byte2IntRBTreeMap extends AbstractByte2IntMap implements Byte2IntNa
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
int newValue = mappingFunction.applyAsInt(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -502,18 +524,6 @@ public class Byte2IntRBTreeMap extends AbstractByte2IntMap implements Byte2IntNa
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
int newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -532,16 +542,6 @@ public class Byte2IntRBTreeMap extends AbstractByte2IntMap implements Byte2IntNa
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
int newValue = mappingFunction.applyAsInt(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
public int computeIntIfPresentNonDefault(byte key, ByteIntUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1621,14 +1621,9 @@ public class Byte2IntRBTreeMap extends AbstractByte2IntMap implements Byte2IntNa
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
int newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -454,6 +454,40 @@ public class Byte2LongAVLTreeMap extends AbstractByte2LongMap implements Byte2Lo
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
long newValue = valueProvider.getAsLong();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
long newValue = mappingFunction.applyAsLong(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -473,18 +507,6 @@ public class Byte2LongAVLTreeMap extends AbstractByte2LongMap implements Byte2Lo
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -503,18 +525,6 @@ public class Byte2LongAVLTreeMap extends AbstractByte2LongMap implements Byte2Lo
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
long newValue = valueProvider.getAsLong();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -533,16 +543,6 @@ public class Byte2LongAVLTreeMap extends AbstractByte2LongMap implements Byte2Lo
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
long newValue = mappingFunction.applyAsLong(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1558,14 +1558,9 @@ public class Byte2LongAVLTreeMap extends AbstractByte2LongMap implements Byte2Lo
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
long newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -453,6 +453,40 @@ public class Byte2LongRBTreeMap extends AbstractByte2LongMap implements Byte2Lon
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
long newValue = mappingFunction.applyAsLong(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
long newValue = valueProvider.getAsLong();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
long newValue = mappingFunction.applyAsLong(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -472,18 +506,6 @@ public class Byte2LongRBTreeMap extends AbstractByte2LongMap implements Byte2Lon
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
long newValue = mappingFunction.applyAsLong(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -502,18 +524,6 @@ public class Byte2LongRBTreeMap extends AbstractByte2LongMap implements Byte2Lon
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
long newValue = valueProvider.getAsLong();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -532,16 +542,6 @@ public class Byte2LongRBTreeMap extends AbstractByte2LongMap implements Byte2Lon
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
long newValue = mappingFunction.applyAsLong(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
public long computeLongIfPresentNonDefault(byte key, ByteLongUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1621,14 +1621,9 @@ public class Byte2LongRBTreeMap extends AbstractByte2LongMap implements Byte2Lon
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
long newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -395,25 +395,6 @@ public class Byte2ObjectAVLTreeMap<V> extends AbstractByte2ObjectMap<V> implemen
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
V newValue = mappingFunction.apply(key, getDefaultReturnValue());
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = mappingFunction.apply(key, entry.value);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -432,24 +413,6 @@ public class Byte2ObjectAVLTreeMap<V> extends AbstractByte2ObjectMap<V> implemen
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
if(Objects.equals(entry.value, getDefaultReturnValue())) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
entry.value = newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -468,24 +431,6 @@ public class Byte2ObjectAVLTreeMap<V> extends AbstractByte2ObjectMap<V> implemen
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
if(Objects.equals(entry.value, getDefaultReturnValue())) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
entry.value = newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -500,20 +445,6 @@ public class Byte2ObjectAVLTreeMap<V> extends AbstractByte2ObjectMap<V> implemen
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null || Objects.equals(entry.value, getDefaultReturnValue())) return getDefaultReturnValue();
|
|
||||||
V newValue = mappingFunction.apply(key, entry.value);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -394,25 +394,6 @@ public class Byte2ObjectRBTreeMap<V> extends AbstractByte2ObjectMap<V> implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
V newValue = mappingFunction.apply(key, getDefaultReturnValue());
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
V newValue = mappingFunction.apply(key, entry.value);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -431,24 +412,6 @@ public class Byte2ObjectRBTreeMap<V> extends AbstractByte2ObjectMap<V> implement
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
if(Objects.equals(entry.value, getDefaultReturnValue())) {
|
|
||||||
V newValue = mappingFunction.apply(key);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
entry.value = newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
@ -467,24 +430,6 @@ public class Byte2ObjectRBTreeMap<V> extends AbstractByte2ObjectMap<V> implement
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
if(Objects.equals(entry.value, getDefaultReturnValue())) {
|
|
||||||
V newValue = valueProvider.get();
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) return newValue;
|
|
||||||
entry.value = newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -499,20 +444,6 @@ public class Byte2ObjectRBTreeMap<V> extends AbstractByte2ObjectMap<V> implement
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node<V> entry = findNode(key);
|
|
||||||
if(entry == null || Objects.equals(entry.value, getDefaultReturnValue())) return getDefaultReturnValue();
|
|
||||||
V newValue = mappingFunction.apply(key, entry.value);
|
|
||||||
if(Objects.equals(newValue, getDefaultReturnValue())) {
|
|
||||||
removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
public V merge(byte key, V value, ObjectObjectUnaryOperator<V, V> mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
|||||||
@ -454,6 +454,40 @@ public class Byte2ShortAVLTreeMap extends AbstractByte2ShortMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
short newValue = valueProvider.getAsShort();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
short newValue = mappingFunction.applyAsShort(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -473,18 +507,6 @@ public class Byte2ShortAVLTreeMap extends AbstractByte2ShortMap implements Byte2
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -503,46 +525,24 @@ public class Byte2ShortAVLTreeMap extends AbstractByte2ShortMap implements Byte2
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
short newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(entry.value == getDefaultReturnValue()) {
|
if(entry.value == getDefaultReturnValue()) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
short newValue = mappingFunction.applyAsShort(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1558,14 +1558,9 @@ public class Byte2ShortAVLTreeMap extends AbstractByte2ShortMap implements Byte2
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
short newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -453,6 +453,40 @@ public class Byte2ShortRBTreeMap extends AbstractByte2ShortMap implements Byte2S
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
short newValue = mappingFunction.applyAsShort(key);
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
||||||
|
Objects.requireNonNull(valueProvider);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) {
|
||||||
|
short newValue = valueProvider.getAsShort();
|
||||||
|
put(key, newValue);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return entry.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
Node entry = findNode(key);
|
||||||
|
if(entry == null) return getDefaultReturnValue();
|
||||||
|
short newValue = mappingFunction.applyAsShort(key, entry.value);
|
||||||
|
entry.value = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -472,18 +506,6 @@ public class Byte2ShortRBTreeMap extends AbstractByte2ShortMap implements Byte2S
|
|||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
short newValue = mappingFunction.applyAsShort(key);
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -502,46 +524,24 @@ public class Byte2ShortRBTreeMap extends AbstractByte2ShortMap implements Byte2S
|
|||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider) {
|
|
||||||
Objects.requireNonNull(valueProvider);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) {
|
|
||||||
short newValue = valueProvider.getAsInt();
|
|
||||||
put(key, newValue);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
return entry.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider) {
|
||||||
Objects.requireNonNull(valueProvider);
|
Objects.requireNonNull(valueProvider);
|
||||||
Node entry = findNode(key);
|
Node entry = findNode(key);
|
||||||
if(entry == null) {
|
if(entry == null) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
put(key, newValue);
|
put(key, newValue);
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
if(entry.value == getDefaultReturnValue()) {
|
if(entry.value == getDefaultReturnValue()) {
|
||||||
short newValue = valueProvider.getAsInt();
|
short newValue = valueProvider.getAsShort();
|
||||||
if(newValue == getDefaultReturnValue()) return newValue;
|
if(newValue == getDefaultReturnValue()) return newValue;
|
||||||
entry.value = newValue;
|
entry.value = newValue;
|
||||||
}
|
}
|
||||||
return entry.value;
|
return entry.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction) {
|
|
||||||
Objects.requireNonNull(mappingFunction);
|
|
||||||
Node entry = findNode(key);
|
|
||||||
if(entry == null) return getDefaultReturnValue();
|
|
||||||
short newValue = mappingFunction.applyAsShort(key, entry.value);
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
public short computeShortIfPresentNonDefault(byte key, ByteShortUnaryOperator mappingFunction) {
|
||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
@ -1621,14 +1621,9 @@ public class Byte2ShortRBTreeMap extends AbstractByte2ShortMap implements Byte2S
|
|||||||
Objects.requireNonNull(mappingFunction);
|
Objects.requireNonNull(mappingFunction);
|
||||||
if(!inRange(key)) return getDefaultReturnValue();
|
if(!inRange(key)) return getDefaultReturnValue();
|
||||||
Node entry = map.findNode(key);
|
Node entry = map.findNode(key);
|
||||||
if(entry == null || entry.value == getDefaultReturnValue()) return getDefaultReturnValue();
|
if(entry == null) return getDefaultReturnValue();
|
||||||
short newValue = mappingFunction.apply(key, entry.value);
|
entry.value = mappingFunction.apply(key, entry.value);
|
||||||
if(newValue == getDefaultReturnValue()) {
|
return entry.value;
|
||||||
map.removeNode(entry);
|
|
||||||
return newValue;
|
|
||||||
}
|
|
||||||
entry.value = newValue;
|
|
||||||
return newValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -283,15 +283,6 @@ public interface Byte2BooleanMap extends Map<Byte, Boolean>, BytePredicate
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public boolean computeBoolean(byte key, ByteBooleanUnaryOperator mappingFunction);
|
public boolean computeBoolean(byte key, ByteBooleanUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -301,6 +292,34 @@ public interface Byte2BooleanMap extends Map<Byte, Boolean>, BytePredicate
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction);
|
public boolean computeBooleanIfAbsent(byte key, BytePredicate mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public boolean computeBooleanNonDefault(byte key, ByteBooleanUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -310,15 +329,6 @@ public interface Byte2BooleanMap extends Map<Byte, Boolean>, BytePredicate
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction);
|
public boolean computeBooleanIfAbsentNonDefault(byte key, BytePredicate mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public boolean supplyBooleanIfAbsent(byte key, BooleanSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -328,16 +338,6 @@ public interface Byte2BooleanMap extends Map<Byte, Boolean>, BytePredicate
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider);
|
public boolean supplyBooleanIfAbsentNonDefault(byte key, BooleanSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public boolean computeBooleanIfPresent(byte key, ByteBooleanUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -307,15 +307,6 @@ public interface Byte2ByteMap extends Map<Byte, Byte>, ByteUnaryOperator
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public byte computeByte(byte key, ByteByteUnaryOperator mappingFunction);
|
public byte computeByte(byte key, ByteByteUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -325,6 +316,34 @@ public interface Byte2ByteMap extends Map<Byte, Byte>, ByteUnaryOperator
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction);
|
public byte computeByteIfAbsent(byte key, ByteUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public byte computeByteNonDefault(byte key, ByteByteUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -334,15 +353,6 @@ public interface Byte2ByteMap extends Map<Byte, Byte>, ByteUnaryOperator
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction);
|
public byte computeByteIfAbsentNonDefault(byte key, ByteUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public byte supplyByteIfAbsent(byte key, ByteSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -352,16 +362,6 @@ public interface Byte2ByteMap extends Map<Byte, Byte>, ByteUnaryOperator
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider);
|
public byte supplyByteIfAbsentNonDefault(byte key, ByteSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public byte computeByteIfPresent(byte key, ByteByteUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -308,15 +308,6 @@ public interface Byte2CharMap extends Map<Byte, Character>, Byte2CharFunction
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public char computeChar(byte key, ByteCharUnaryOperator mappingFunction);
|
public char computeChar(byte key, ByteCharUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -326,6 +317,34 @@ public interface Byte2CharMap extends Map<Byte, Character>, Byte2CharFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction);
|
public char computeCharIfAbsent(byte key, Byte2CharFunction mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public char computeCharNonDefault(byte key, ByteCharUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -335,15 +354,6 @@ public interface Byte2CharMap extends Map<Byte, Character>, Byte2CharFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction);
|
public char computeCharIfAbsentNonDefault(byte key, Byte2CharFunction mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public char supplyCharIfAbsent(byte key, CharSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -353,16 +363,6 @@ public interface Byte2CharMap extends Map<Byte, Character>, Byte2CharFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider);
|
public char supplyCharIfAbsentNonDefault(byte key, CharSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public char computeCharIfPresent(byte key, ByteCharUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -308,15 +308,6 @@ public interface Byte2DoubleMap extends Map<Byte, Double>, Byte2DoubleFunction
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public double computeDouble(byte key, ByteDoubleUnaryOperator mappingFunction);
|
public double computeDouble(byte key, ByteDoubleUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -326,6 +317,34 @@ public interface Byte2DoubleMap extends Map<Byte, Double>, Byte2DoubleFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction);
|
public double computeDoubleIfAbsent(byte key, Byte2DoubleFunction mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public double computeDoubleNonDefault(byte key, ByteDoubleUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -335,15 +354,6 @@ public interface Byte2DoubleMap extends Map<Byte, Double>, Byte2DoubleFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction);
|
public double computeDoubleIfAbsentNonDefault(byte key, Byte2DoubleFunction mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public double supplyDoubleIfAbsent(byte key, DoubleSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -353,16 +363,6 @@ public interface Byte2DoubleMap extends Map<Byte, Double>, Byte2DoubleFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider);
|
public double supplyDoubleIfAbsentNonDefault(byte key, DoubleSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public double computeDoubleIfPresent(byte key, ByteDoubleUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -308,15 +308,6 @@ public interface Byte2FloatMap extends Map<Byte, Float>, Byte2FloatFunction
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public float computeFloat(byte key, ByteFloatUnaryOperator mappingFunction);
|
public float computeFloat(byte key, ByteFloatUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -326,6 +317,34 @@ public interface Byte2FloatMap extends Map<Byte, Float>, Byte2FloatFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction);
|
public float computeFloatIfAbsent(byte key, Byte2FloatFunction mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public float computeFloatNonDefault(byte key, ByteFloatUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -335,15 +354,6 @@ public interface Byte2FloatMap extends Map<Byte, Float>, Byte2FloatFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction);
|
public float computeFloatIfAbsentNonDefault(byte key, Byte2FloatFunction mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public float supplyFloatIfAbsent(byte key, FloatSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -353,16 +363,6 @@ public interface Byte2FloatMap extends Map<Byte, Float>, Byte2FloatFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider);
|
public float supplyFloatIfAbsentNonDefault(byte key, FloatSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public float computeFloatIfPresent(byte key, ByteFloatUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -308,15 +308,6 @@ public interface Byte2IntMap extends Map<Byte, Integer>, Byte2IntFunction
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public int computeInt(byte key, ByteIntUnaryOperator mappingFunction);
|
public int computeInt(byte key, ByteIntUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -326,6 +317,34 @@ public interface Byte2IntMap extends Map<Byte, Integer>, Byte2IntFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction);
|
public int computeIntIfAbsent(byte key, Byte2IntFunction mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public int computeIntNonDefault(byte key, ByteIntUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -335,15 +354,6 @@ public interface Byte2IntMap extends Map<Byte, Integer>, Byte2IntFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction);
|
public int computeIntIfAbsentNonDefault(byte key, Byte2IntFunction mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public int supplyIntIfAbsent(byte key, IntSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -353,16 +363,6 @@ public interface Byte2IntMap extends Map<Byte, Integer>, Byte2IntFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider);
|
public int supplyIntIfAbsentNonDefault(byte key, IntSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public int computeIntIfPresent(byte key, ByteIntUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -308,15 +308,6 @@ public interface Byte2LongMap extends Map<Byte, Long>, Byte2LongFunction
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public long computeLong(byte key, ByteLongUnaryOperator mappingFunction);
|
public long computeLong(byte key, ByteLongUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -326,6 +317,34 @@ public interface Byte2LongMap extends Map<Byte, Long>, Byte2LongFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction);
|
public long computeLongIfAbsent(byte key, Byte2LongFunction mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public long computeLongNonDefault(byte key, ByteLongUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -335,15 +354,6 @@ public interface Byte2LongMap extends Map<Byte, Long>, Byte2LongFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction);
|
public long computeLongIfAbsentNonDefault(byte key, Byte2LongFunction mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public long supplyLongIfAbsent(byte key, LongSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -353,16 +363,6 @@ public interface Byte2LongMap extends Map<Byte, Long>, Byte2LongFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider);
|
public long supplyLongIfAbsentNonDefault(byte key, LongSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public long computeLongIfPresent(byte key, ByteLongUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -266,15 +266,6 @@ public interface Byte2ObjectMap<V> extends Map<Byte, V>, ByteFunction<V>
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public V compute(byte key, ByteObjectUnaryOperator<V> mappingFunction);
|
public V compute(byte key, ByteObjectUnaryOperator<V> mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public V computeNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -284,15 +275,6 @@ public interface Byte2ObjectMap<V> extends Map<Byte, V>, ByteFunction<V>
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction);
|
public V computeIfAbsent(byte key, ByteFunction<V> mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public V computeIfAbsentNonDefault(byte key, ByteFunction<V> mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -302,15 +284,6 @@ public interface Byte2ObjectMap<V> extends Map<Byte, V>, ByteFunction<V>
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider);
|
public V supplyIfAbsent(byte key, ObjectSupplier<V> valueProvider);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public V supplyIfAbsentNonDefault(byte key, ObjectSupplier<V> valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -321,16 +294,6 @@ public interface Byte2ObjectMap<V> extends Map<Byte, V>, ByteFunction<V>
|
|||||||
* @note if not present then compute is not executed
|
* @note if not present then compute is not executed
|
||||||
*/
|
*/
|
||||||
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction);
|
public V computeIfPresent(byte key, ByteObjectUnaryOperator<V> mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public V computeIfPresentNonDefault(byte key, ByteObjectUnaryOperator<V> mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific merge method to reduce boxing/unboxing
|
* A Type Specific merge method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -308,15 +308,6 @@ public interface Byte2ShortMap extends Map<Byte, Short>, Byte2ShortFunction
|
|||||||
* @return the result of the computation
|
* @return the result of the computation
|
||||||
*/
|
*/
|
||||||
public short computeShort(byte key, ByteShortUnaryOperator mappingFunction);
|
public short computeShort(byte key, ByteShortUnaryOperator mappingFunction);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value
|
|
||||||
* @return the result of the computation
|
|
||||||
*/
|
|
||||||
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -326,6 +317,34 @@ public interface Byte2ShortMap extends Map<Byte, Short>, Byte2ShortFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction);
|
public short computeShortIfAbsent(byte key, Byte2ShortFunction mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param valueProvider the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
|
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
|
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
|
public short computeShortNonDefault(byte key, ByteShortUnaryOperator mappingFunction);
|
||||||
/**
|
/**
|
||||||
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
* A Type Specific computeIfAbsent method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -335,15 +354,6 @@ public interface Byte2ShortMap extends Map<Byte, Short>, Byte2ShortFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction);
|
public short computeShortIfAbsentNonDefault(byte key, Byte2ShortFunction mappingFunction);
|
||||||
/**
|
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param valueProvider the value if not present
|
|
||||||
* @return the result of the computed value or present value
|
|
||||||
*/
|
|
||||||
public short supplyShortIfAbsent(byte key, ShortSupplier valueProvider);
|
|
||||||
/**
|
/**
|
||||||
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
@ -353,16 +363,6 @@ public interface Byte2ShortMap extends Map<Byte, Short>, Byte2ShortFunction
|
|||||||
* @return the result of the computed value or present value
|
* @return the result of the computed value or present value
|
||||||
*/
|
*/
|
||||||
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider);
|
public short supplyShortIfAbsentNonDefault(byte key, ShortSupplier valueProvider);
|
||||||
/**
|
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
|
||||||
* A "Null Value" will be treated as "Do not insert/remove" based on how the Java has specified it.
|
|
||||||
* @param key the key that should be computed
|
|
||||||
* @param mappingFunction the operator that should generate the value if present
|
|
||||||
* @return the result of the default return value or present value
|
|
||||||
* @note if not present then compute is not executed
|
|
||||||
*/
|
|
||||||
public short computeShortIfPresent(byte key, ByteShortUnaryOperator mappingFunction);
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific compute method to reduce boxing/unboxing
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
* If the generated value equals the getDefaultReturnValue it will simply not insert it since that is treated as "null".
|
||||||
|
|||||||
@ -146,6 +146,15 @@ public class ByteArrayFIFOQueue extends AbstractBytePriorityQueue implements Byt
|
|||||||
return index >= array.length ? array[index-array.length] : array[index];
|
return index >= array.length ? array[index-array.length] : array[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(byte e) {
|
||||||
|
if(first == last) return false;
|
||||||
|
for(int i = 0,m=size();i<m;i++) {
|
||||||
|
if(e == array[(first + i) % array.length]) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeFirst(byte e) {
|
public boolean removeFirst(byte e) {
|
||||||
if(first == last) return false;
|
if(first == last) return false;
|
||||||
|
|||||||
@ -208,6 +208,13 @@ public class ByteArrayPriorityQueue extends AbstractBytePriorityQueue
|
|||||||
return array[index];
|
return array[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(byte e) {
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
if(e == array[i]) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeFirst(byte e) {
|
public boolean removeFirst(byte e) {
|
||||||
for(int i = 0;i<size;i++)
|
for(int i = 0;i<size;i++)
|
||||||
|
|||||||
@ -213,6 +213,13 @@ public class ByteHeapPriorityQueue extends AbstractBytePriorityQueue
|
|||||||
return array[index];
|
return array[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(byte e) {
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
if(e == array[i]) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeFirst(byte e) {
|
public boolean removeFirst(byte e) {
|
||||||
for(int i = 0;i<size;i++)
|
for(int i = 0;i<size;i++)
|
||||||
|
|||||||
@ -89,6 +89,13 @@ public interface BytePriorityQueue extends ByteIterable
|
|||||||
*/
|
*/
|
||||||
public default byte first() { return peek(0); }
|
public default byte first() { return peek(0); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to find out if a element is part of the queue
|
||||||
|
* @param e the element that is searched for
|
||||||
|
* @return true if the element is in the queue
|
||||||
|
*/
|
||||||
|
public boolean contains(byte e);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the first found element in the queue
|
* Removes the first found element in the queue
|
||||||
* @param e the element that should be removed
|
* @param e the element that should be removed
|
||||||
|
|||||||
@ -21,12 +21,10 @@ import speiger.src.collections.bytes.lists.ByteList;
|
|||||||
import speiger.src.collections.bytes.lists.ByteArrayList;
|
import speiger.src.collections.bytes.lists.ByteArrayList;
|
||||||
import speiger.src.collections.bytes.sets.ByteSet;
|
import speiger.src.collections.bytes.sets.ByteSet;
|
||||||
import speiger.src.collections.bytes.sets.ByteLinkedOpenHashSet;
|
import speiger.src.collections.bytes.sets.ByteLinkedOpenHashSet;
|
||||||
import speiger.src.collections.booleans.utils.BooleanAsyncBuilder;
|
import speiger.src.collections.booleans.utils.BooleanAsyncBuilder;import speiger.src.collections.booleans.utils.BooleanAsyncBuilder.BaseBooleanTask;
|
||||||
import speiger.src.collections.booleans.utils.BooleanAsyncBuilder.BaseBooleanTask;
|
|
||||||
import speiger.src.collections.objects.utils.ObjectAsyncBuilder;
|
import speiger.src.collections.objects.utils.ObjectAsyncBuilder;
|
||||||
import speiger.src.collections.objects.utils.ObjectAsyncBuilder.BaseObjectTask;
|
import speiger.src.collections.objects.utils.ObjectAsyncBuilder.BaseObjectTask;
|
||||||
import speiger.src.collections.ints.utils.IntAsyncBuilder;
|
import speiger.src.collections.ints.utils.IntAsyncBuilder;import speiger.src.collections.ints.utils.IntAsyncBuilder.BaseIntTask;
|
||||||
import speiger.src.collections.ints.utils.IntAsyncBuilder.BaseIntTask;
|
|
||||||
import speiger.src.collections.utils.ISizeProvider;
|
import speiger.src.collections.utils.ISizeProvider;
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package speiger.src.collections.bytes.utils;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import speiger.src.collections.bytes.collections.ByteIterator;
|
import speiger.src.collections.bytes.collections.ByteIterator;
|
||||||
import speiger.src.collections.objects.collections.ObjectIterator;
|
import speiger.src.collections.objects.collections.ObjectIterator;
|
||||||
@ -9,6 +10,7 @@ import speiger.src.collections.objects.utils.ObjectIterators;
|
|||||||
import speiger.src.collections.bytes.functions.ByteConsumer;
|
import speiger.src.collections.bytes.functions.ByteConsumer;
|
||||||
import speiger.src.collections.bytes.functions.ByteComparator;
|
import speiger.src.collections.bytes.functions.ByteComparator;
|
||||||
import speiger.src.collections.bytes.functions.function.ByteFunction;
|
import speiger.src.collections.bytes.functions.function.ByteFunction;
|
||||||
|
import speiger.src.collections.objects.functions.consumer.ObjectByteConsumer;
|
||||||
import speiger.src.collections.bytes.functions.function.BytePredicate;
|
import speiger.src.collections.bytes.functions.function.BytePredicate;
|
||||||
import speiger.src.collections.bytes.lists.ByteList;
|
import speiger.src.collections.bytes.lists.ByteList;
|
||||||
import speiger.src.collections.bytes.lists.ByteArrayList;
|
import speiger.src.collections.bytes.lists.ByteArrayList;
|
||||||
@ -16,6 +18,7 @@ import speiger.src.collections.bytes.lists.ByteArrayList;
|
|||||||
import speiger.src.collections.bytes.lists.ByteListIterator;
|
import speiger.src.collections.bytes.lists.ByteListIterator;
|
||||||
import speiger.src.collections.bytes.collections.ByteBidirectionalIterator;
|
import speiger.src.collections.bytes.collections.ByteBidirectionalIterator;
|
||||||
import speiger.src.collections.bytes.collections.ByteCollection;
|
import speiger.src.collections.bytes.collections.ByteCollection;
|
||||||
|
import speiger.src.collections.bytes.utils.ByteCollections.CollectionWrapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Helper class for Iterators
|
* A Helper class for Iterators
|
||||||
@ -206,6 +209,24 @@ public class ByteIterators
|
|||||||
return new RepeatingIterator(wrap(iterator), repeats);
|
return new RepeatingIterator(wrap(iterator), repeats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper function that creates a infinitely looping iterator
|
||||||
|
* @param iterator that should be looping infinitely
|
||||||
|
* @return a infinitely looping iterator
|
||||||
|
*/
|
||||||
|
public static ByteIterator infinite(ByteIterator iterator) {
|
||||||
|
return new InfiniteIterator(iterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper function that creates a infinitely looping iterator from a Java Iterator
|
||||||
|
* @param iterator that should be looping infinitely
|
||||||
|
* @return a infinitely looping iterator
|
||||||
|
*/
|
||||||
|
public static ByteIterator infinite(Iterator<? extends Byte> iterator) {
|
||||||
|
return new InfiniteIterator(wrap(iterator));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Helper function that hard limits the Iterator to a specific size
|
* A Helper function that hard limits the Iterator to a specific size
|
||||||
* @param iterator that should be limited
|
* @param iterator that should be limited
|
||||||
@ -841,6 +862,40 @@ public class ByteIterators
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class InfiniteIterator implements ByteIterator
|
||||||
|
{
|
||||||
|
ByteIterator iter;
|
||||||
|
CollectionWrapper looper = ByteCollections.wrapper();
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
public InfiniteIterator(ByteIterator iter) {
|
||||||
|
this.iter = iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte nextByte() {
|
||||||
|
if(iter != null) {
|
||||||
|
if(iter.hasNext()) {
|
||||||
|
byte value = iter.nextByte();
|
||||||
|
looper.add(value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
else iter = null;
|
||||||
|
}
|
||||||
|
return looper.getByte((index++) % looper.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEachRemaining(ByteConsumer action) { throw new UnsupportedOperationException("This is a instant deadlock, so unsupported"); }
|
||||||
|
public void forEachRemaining(Consumer<? super Byte> action) { throw new UnsupportedOperationException("This is a instant deadlock, so unsupported"); }
|
||||||
|
public <E> void forEachRemaining(E input, ObjectByteConsumer<E> action) { throw new UnsupportedOperationException("This is a instant deadlock, so unsupported"); }
|
||||||
|
}
|
||||||
|
|
||||||
private static class RepeatingIterator implements ByteIterator
|
private static class RepeatingIterator implements ByteIterator
|
||||||
{
|
{
|
||||||
final int repeats;
|
final int repeats;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user