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

shz.core.serializable.SerializableComparator Maven / Gradle / Ivy

There is a newer version: 2024.0.2
Show newest version
package shz.core.serializable;

import java.io.Serializable;
import java.util.Comparator;
import java.util.Objects;

@FunctionalInterface
public interface SerializableComparator extends Comparator, Serializable {
    static  SerializableComparator comparingInt(SerializableToIntFunction keyExtractor) {
        Objects.requireNonNull(keyExtractor);
        return (SerializableComparator & Serializable) (c1, c2) -> Integer.compare(keyExtractor.applyAsInt(c1), keyExtractor.applyAsInt(c2));
    }

    static  SerializableComparator comparingLong(SerializableToLongFunction keyExtractor) {
        Objects.requireNonNull(keyExtractor);
        return (SerializableComparator & Serializable) (c1, c2) -> Long.compare(keyExtractor.applyAsLong(c1), keyExtractor.applyAsLong(c2));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy