Class StringMatchUtil


  • public final class StringMatchUtil
    extends java.lang.Object
    Utility class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.stream.Stream<MatchResult<T>> filterResults​(java.util.List<? extends T> candidates, java.util.function.Function<? super T,​java.lang.String> matchExtractor, java.lang.String query, MatchSelector<T> limiter)
      Selects the best MatchResult given a list of candidates and a query.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • filterResults

        public static <T> java.util.stream.Stream<MatchResult<T>> filterResults​(java.util.List<? extends T> candidates,
                                                                                java.util.function.Function<? super T,​java.lang.String> matchExtractor,
                                                                                java.lang.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