small refactor
This commit is contained in:
@@ -20,10 +20,22 @@ import java.util.stream.StreamSupport;
|
||||
|
||||
@Slf4j
|
||||
public class JWO {
|
||||
public static <T> Stream<T> iterable2stream(Iterable<T> iterable) {
|
||||
public static <T> Stream<T> iterable2Stream(Iterable<T> iterable) {
|
||||
return StreamSupport.stream(iterable.spliterator(), false);
|
||||
}
|
||||
|
||||
public static <T> Stream<T> iterable2ParallelStream(Iterable<T> iterable) {
|
||||
return StreamSupport.stream(iterable.spliterator(), true);
|
||||
}
|
||||
|
||||
public static <T> Stream<T> iterator2Stream(Iterator<T> it) {
|
||||
return iterable2Stream(() -> it);
|
||||
}
|
||||
|
||||
public static <T> Stream<T> iterator2ParallelStream(Iterator<T> it) {
|
||||
return iterable2ParallelStream(() -> it);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void writeObject2File(Path file, Object o) {
|
||||
try (Writer writer = new OutputStreamWriter(new FileOutputStream(file.toString()))) {
|
||||
|
Reference in New Issue
Block a user