Interface SerializableComparator<T>

  • Type Parameters:
    T - the type of objects that may be compared by this comparator
    All Superinterfaces:
    java.util.Comparator<T>, java.io.Serializable
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface SerializableComparator<T>
    extends java.util.Comparator<T>, java.io.Serializable
    A Comparator that is also Serializable.

    You can create a serializable comparator from a regular comparator through a method reference by appending ::compare. For example SerializableComparator<Employee> comparator = Comparator.comparing(Employee::getFirstName)::compare. The resulting comparator will in most cases cause exceptions if it is actually being serialized, but this construct will enable using the shorthands in Comparator in applications where session will not be serialized.

    Since:
    8.0
    Author:
    Vaadin Ltd
    • Method Summary

      • Methods inherited from interface java.util.Comparator

        compare, equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong