@Override public int hashCode() { int result = 1; result = 31 * result + (values != null ? Lng.hashCode(0, end, values) : 0); result = 31 * result + end; return result; }
/** * Add a new value to the list but don't employ a wrapper. * * @param integer new value * @return was able to add. */ public boolean addLong(long integer) { if (end + 1 >= values.length) { values = Lng.grow(values); } values[end] = integer; end++; return true; }
/** * Add a new array to the list. * * @param newValues new values * @return was able to add. */ public boolean addArray(long... newValues) { if (end + newValues.length >= values.length) { values = Lng.grow(values, (values.length + newValues.length) * 2); } System.arraycopy(newValues, 0, values, end, newValues.length); end += newValues.length; return true; }
/** * Add a new value to the list but don't employ a wrapper. * * @param integer new value * @return was able to add. */ @SuppressWarnings("UnusedReturnValue") public StatList add(int integer) { if (end + 1 >= values.length) { values = Lng.grow(values); } values[end] = integer; end++; return this; }
@SuppressWarnings("SimplifiableIfStatement") @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StatList integers = (StatList) o; //noinspection SimplifiableIfStatement if (end != integers.end) return false; return Lng.equals(0, end, values, integers.values); }
/** * median * * @return median */ public long median() { return Lng.median(values, end); }
/** * min * * @return min */ public long min() { return Lng.min(values, end); }
/** * max * * @return max */ public long max() { return Lng.max(values, end); }
/** * @param reduceBy reduceBy function * @return the reduction */ public long reduceBy(Lng.ReduceBy reduceBy) { return Lng.reduceBy(values, end, reduceBy); }
/** * This would be a good opportunity to reintroduce dynamic invoke * * @param function function * @param name name * @return result */ public long reduceBy(Object function, String name) { return Lng.reduceBy(values, end, function, name); }
/** * This would be a good opportunity to reintroduce dynamic invoke * * @param function function * @return array */ public long reduceBy(Object function) { return Lng.reduceBy(values, end, function); }
/** * Sums the values with bounds checking. * * @return sum */ public long sum() { return Lng.sum(values, end); }