Class StreamUtil

java.lang.Object
org.omegat.util.StreamUtil

public final class StreamUtil extends Object
  • Method Details

    • localeComparator

      public static <T> Comparator<T> localeComparator(Function<? super T,? extends String> keyExtractor)
      Get a comparator that compares based on PRIMARY differences with the current default locale.
      Parameters:
      keyExtractor - Function for obtaining strings that the Collator can compare
      Returns:
      A comparator useful for e.g. sorting lists of files in a stable fashion
    • comparatorByList

      public static Comparator<String> comparatorByList(List<String> order)
      Get a comparator that sorts according to the provided list. Items not appearing in the list are sorted alphabetically.
    • patternFilter

      public static <T> Predicate<T> patternFilter(String regex, Function<T,String> stringExtractor)