ch.lambdaj.function.aggregate.Max Maven / Gradle / Ivy
// Modified or written by Ex Machina SAGL for inclusion with lambdaj.
// Copyright (c) 2009 Mario Fusco.
// Licensed under the Apache License, Version 2.0 (the "License")
package ch.lambdaj.function.aggregate;
/**
* A chooser of the maximum value between two comparable
* @author Mario Fusco
*/
public class Max extends Chooser> {
/**
* Chooses the maximum value between two Comparable
* @param first The first item between which find the maximum
* @param second The second item between which find the maximum
* @return The biggest between the two items
*/
@SuppressWarnings("unchecked")
@Override
protected Comparable choose(Comparable first, Comparable second) {
return first.compareTo((T) second) > 0 ? first : second;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy