Package org.omegat.util
Class StreamUtil
- java.lang.Object
-
- org.omegat.util.StreamUtil
-
public final class StreamUtil extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Comparator<java.lang.String>
comparatorByList(java.util.List<java.lang.String> order)
Get a comparator that sorts according to the provided list.static <T> java.util.Comparator<T>
localeComparator(java.util.function.Function<? super T,? extends java.lang.String> keyExtractor)
Get a comparator that compares based on PRIMARY differences with the current default locale.static <T> java.util.function.Predicate<T>
patternFilter(java.lang.String regex, java.util.function.Function<T,java.lang.String> stringExtractor)
-
-
-
Method Detail
-
localeComparator
public static <T> java.util.Comparator<T> localeComparator(java.util.function.Function<? super T,? extends java.lang.String> keyExtractor)
Get a comparator that compares based on PRIMARY differences with the current default locale.- Parameters:
keyExtractor
- Function for obtaining strings that theCollator
can compare- Returns:
- A comparator useful for e.g. sorting lists of files in a stable fashion
-
comparatorByList
public static java.util.Comparator<java.lang.String> comparatorByList(java.util.List<java.lang.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> java.util.function.Predicate<T> patternFilter(java.lang.String regex, java.util.function.Function<T,java.lang.String> stringExtractor)
-
-