aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_StreamUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_StreamUtil.java')
-rw-r--r--src/main/java/gregtech/api/util/GT_StreamUtil.java44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/main/java/gregtech/api/util/GT_StreamUtil.java b/src/main/java/gregtech/api/util/GT_StreamUtil.java
deleted file mode 100644
index c29e611c4e..0000000000
--- a/src/main/java/gregtech/api/util/GT_StreamUtil.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package gregtech.api.util;
-
-import java.util.Arrays;
-import java.util.function.Supplier;
-import java.util.stream.Stream;
-
-import javax.annotation.Nullable;
-import javax.annotation.ParametersAreNonnullByDefault;
-
-@ParametersAreNonnullByDefault
-@MethodsReturnNonnullByDefault
-public final class GT_StreamUtil {
-
- /**
- * Backport of {@link Stream#ofNullable}.
- */
- public static <T> Stream<T> ofNullable(@Nullable T value) {
- return value == null ? Stream.empty() : Stream.of(value);
- }
-
- /**
- * Returns a sequential ordered {@code Stream} whose elements are the specified values,
- * if {@code condition} is true, otherwise returns an empty {@code Stream}.
- *
- * @param <T> the type of stream elements
- * @param values the elements of the new stream
- * @return the new stream
- */
- public static <T> Stream<T> ofConditional(boolean condition, T[] values) {
- return condition ? Arrays.stream(values) : Stream.empty();
- }
-
- /**
- * Returns a sequential {@code Stream} containing a single element, which will be lazily evaluated from supplier.
- *
- * @param <T> the type of stream elements
- * @param supplier the supplier for single stream element
- * @return the new stream
- */
- public static <T> Stream<T> ofSupplier(Supplier<T> supplier) {
- return Stream.generate(supplier)
- .limit(1);
- }
-}