public class MathUtils extends Object
Modifier and Type | Method and Description |
---|---|
static double |
average(int total,
int size)
Calculates the average
|
static double |
averageDouble(Stream<Double> values)
Gets the average of a Stream of Double.
|
static double |
averageInt(Stream<Integer> values)
Gets the average of a Stream of Integers.
|
static long |
averageLong(Collection<Long> values)
Gets the average of a Collection with Long as Entry.
|
static long |
averageLong(long total,
long size)
Calculates the average
|
static long |
averageLong(Stream<Long> values)
Gets the average of a Stream of Longs.
|
static long |
countTrueBoolean(Stream<Boolean> values)
Counts all Booleans that are true in the Stream of Booleans
|
static int |
getBiggest(Collection<Integer> values)
Gets the biggest Integer in a Collection with Integer as Entry
If the Collection is empty, it will return 1.
|
static long |
getBiggestLong(Collection<Long> values)
Gets the biggest Long in a Collection with Long as Entry
If the Collection is empty, it will return 1.
|
static double |
round(double number)
Rounds the double to a double with two digits at the end.
|
static double |
sumDouble(Stream<Serializable> values)
Sums all Doubles in a Stream of Serializable
|
static int |
sumInt(Stream<Serializable> values)
Sums all Integers in a Stream of Serializable
|
static long |
sumLong(Stream<Serializable> values)
Sums all Longs in a Stream of Serializable
|
public static double averageInt(Stream<Integer> values)
values
- The Stream of Integers.public static long averageLong(Collection<Long> values)
values
- The Collection with Long as the Entry.averageLong(Stream)
public static long averageLong(Stream<Long> values)
values
- The Stream of Longs.averageLong(Collection)
public static double averageDouble(Stream<Double> values)
values
- The Stream of Double.public static double average(int total, int size)
total
- The total summed amount of all Integerssize
- The amount of all Integers that were summedaverageLong(long, long)
public static long averageLong(long total, long size)
total
- The total summed amount of all Longssize
- The amount of all Longs that were summedaverage(int, int)
public static long countTrueBoolean(Stream<Boolean> values)
values
- The Stream of Booleanspublic static int sumInt(Stream<Serializable> values)
values
- The Stream of SerializablesumLong(Stream)
,
sumDouble(Stream)
public static long sumLong(Stream<Serializable> values)
values
- The Stream of SerializablesumInt(Stream)
,
sumDouble(Stream)
public static double sumDouble(Stream<Serializable> values)
values
- The Stream of SerializablesumLong(Stream)
,
sumInt(Stream)
public static int getBiggest(Collection<Integer> values)
values
- The Collection with Integer as the EntrygetBiggestLong(Collection)
public static long getBiggestLong(Collection<Long> values)
values
- The Collection with Long as the EntrygetBiggest(Collection)
public static double round(double number)
number
- The number that's roundedCopyright © 2017. All rights reserved.