com.vaadin.flow.data.provider.

Interface ItemIndexProvider<T,F>

Type Parameters:

T - the type of the item

F - the type of the query filter

All Superinterfaces:

BiFunction<T,Query<T,F>,Integer>, Serializable, SerializableBiFunction<T,Query<T,F>,Integer>

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 ItemIndexProvider<T,F> extends SerializableBiFunction<T,Query<T,F>,Integer>

A callback interface that is used to provide the index of an item.

Callback gives the target item and the query as parameters to fetch the index. The index is the index of the item in the filtered and sorted data set. If the item is not found, null is expected as a return value.

There will be inconsistent index if the data set for the returned index is different from the component's data set. Changing the data set of either side during this call may cause inconsistent index as a result.

Item index provider is only relevant with lazy data view implementations.

Since:

, 24.4

  • Method Summary

    Modifier and Type
    Method
    Description
    apply(T item, Query<T,F> query)

    Gets the index of the item in the filtered and sorted data set.

    Methods inherited from interface java.util.function.BiFunction

    andThen
  • Method Details

    • apply

      Integer apply(T item, Query<T,F> query)

      Gets the index of the item in the filtered and sorted data set.

      There will be inconsistent index if the data set for the returned index is different from the component's data set. Changing the data set of either side during this call may cause inconsistent index as a result.

      The query parameter provides a filter object being set with ConfigurableFilterDataProvider or provided by a component, e.g. a string filter in ComboBox.

      Specified by:

      apply in interface BiFunction<T,Query<T,F>,Integer>

      Parameters:

      item - Target item to get the index for

      query - Query prepared for fetching all items including filter and sorting.

      Returns:

      the index of the item in the filtered and sorted data set, or null if not found