readd Suggestions.fromIntRange

This commit is contained in:
Marc Baloup 2020-04-06 00:42:07 +02:00
parent 057f5e8cfa
commit b870095bea

View File

@ -7,6 +7,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream; import java.util.stream.Stream;
@FunctionalInterface @FunctionalInterface
@ -73,6 +74,12 @@ public interface Suggestions<S> {
}; };
} }
public static <S> Suggestions<S> fromIntRange(int min, int max) {
return (s, ti, token, a) -> {
return collectFilteredStream(IntStream.range(min, max + 1).mapToObj(Integer::toString), token);
};
}
/** /**