mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
fix ProbabilityCollection#getProbability
This commit is contained in:
parent
beb07337ae
commit
68aa38a51a
@ -23,7 +23,7 @@ public class ProbabilityCollection<E> implements Collection<E> {
|
||||
|
||||
public ProbabilityCollection<E> add(E item, int probability) {
|
||||
if(!cont.containsKey(item)) size++;
|
||||
cont.computeIfAbsent(item, i -> new MutableInteger(0)).increment();
|
||||
cont.computeIfAbsent(item, i -> new MutableInteger(0)).add(probability);
|
||||
int oldLength = array.length;
|
||||
Object[] newArray = new Object[array.length + probability];
|
||||
System.arraycopy(array, 0, newArray, 0, array.length); // Expand array.
|
||||
|
Loading…
x
Reference in New Issue
Block a user