All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.slimgears.util.stream.Comparables Maven / Gradle / Ivy

There is a newer version: 0.7.58
Show newest version
package com.slimgears.util.stream;

import java.util.Comparator;

public class Comparables {
    public static > T max(T first, T second) {
        return Comparator.nullsFirst(Comparator.naturalOrder()).compare(first, second) > 0 ? first : second;
    }

    public static > T min(T first, T second) {
        return Comparator.nullsLast(Comparator.naturalOrder()).compare(first, second) < 0 ? first : second;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy