com.vaadin.server.SerializableComparator Maven / Gradle / Ivy
/*
* Copyright (C) 2000-2024 Vaadin Ltd
*
* This program is available under Vaadin Commercial License and Service Terms.
*
* See for the full
* license.
*/
package com.vaadin.server;
import java.io.Serializable;
import java.util.Comparator;
/**
* A {@link Comparator} that is also {@link 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 {@link Comparator} in applications where session will not be
* serialized.
*
* @author Vaadin Ltd
* @param
* the type of objects that may be compared by this comparator
* @since 8.0
*
*/
@FunctionalInterface
public interface SerializableComparator extends Comparator, Serializable {
// Relevant methods inherited from Comparator
}