Class StringMatchUtil


  • public final class StringMatchUtil
    extends Object
    Utility class.
    • Method Detail

      • filterResults

        public static <T> Stream<MatchResult<T>> filterResults​(List<? extends T> candidates,
                                                               Function<? super T,​String> matchExtractor,
                                                               String query,
                                                               MatchSelector<T> limiter)
        Selects the best MatchResult given a list of candidates and a query.

        The results are useless unless you provide the MatchSelector that suits your use case (limiter).

        Parameters:
        candidates - List of stuff to sort
        matchExtractor - Extracts the searchable text from an item
        limiter - Selects the best candidates, may process them further to break ties
        query - Text to search for