public final class Utils extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Comparable<T>> |
minMax(Iterable<T> items)
Identifies the minimum and maximum elements from an iterable, according
to the natural ordering of the elements.
|
static <T> List<T> |
randomSample(Collection<T> collection,
int n)
Randomly chooses elements from the collection.
|
public static <T extends Comparable<T>> Pair<T> minMax(Iterable<T> items)
T
- The type of the elements.items
- An Iterable
object with the elementspublic static <T> List<T> randomSample(Collection<T> collection, int n)
T
- The type of the elements.collection
- The collection.n
- The number of elements to choose.Copyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.