|
|
@@ -5,7 +5,7 @@ import net.ranides.assira.collection.arrays.ArrayUtils;
|
|
|
import net.ranides.assira.collection.iterators.IteratorUtils;
|
|
|
import net.ranides.assira.collection.query.CQuery;
|
|
|
import net.ranides.assira.collection.query.base.CQAbstractFilter;
|
|
|
-import net.ranides.assira.system.AssiraConfiguration;
|
|
|
+import net.ranides.assira.system.RuntimeConfiguration;
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
@@ -28,8 +28,6 @@ import java.util.stream.Stream;
|
|
|
@UtilityClass
|
|
|
public class BaseFlat {
|
|
|
|
|
|
- private static final boolean DONT_USE_FLAT_STREAM = AssiraConfiguration.DONT_USE_FLAT_STREAM();
|
|
|
-
|
|
|
/**
|
|
|
* Creates new flat stream which tries to apply flattening operation to every core method:
|
|
|
* stream, iterator, each, list.
|
|
|
@@ -58,7 +56,7 @@ public class BaseFlat {
|
|
|
|
|
|
@Override
|
|
|
public Stream<R> stream() {
|
|
|
- if (DONT_USE_FLAT_STREAM) {
|
|
|
+ if (RuntimeConfiguration.FIX_FLAT_STREAM()) {
|
|
|
return BaseIterable.stream(this);
|
|
|
}
|
|
|
return source.stream().flatMap(s -> f.apply(s).stream());
|
|
|
@@ -110,7 +108,7 @@ public class BaseFlat {
|
|
|
|
|
|
@Override
|
|
|
public Stream<R> stream() {
|
|
|
- if (DONT_USE_FLAT_STREAM) {
|
|
|
+ if (RuntimeConfiguration.FIX_FLAT_STREAM()) {
|
|
|
return BaseIterable.stream(this);
|
|
|
}
|
|
|
return source.stream().flatMap(s -> IteratorUtils.stream(f.apply(s).iterator()));
|
|
|
@@ -158,7 +156,7 @@ public class BaseFlat {
|
|
|
|
|
|
@Override
|
|
|
public Stream<R> stream() {
|
|
|
- if (DONT_USE_FLAT_STREAM) {
|
|
|
+ if (RuntimeConfiguration.FIX_FLAT_STREAM()) {
|
|
|
return BaseIterable.stream(this);
|
|
|
}
|
|
|
return source.stream().flatMap(s -> Stream.of(f.apply(s)));
|
|
|
@@ -208,7 +206,7 @@ public class BaseFlat {
|
|
|
|
|
|
@Override
|
|
|
public Stream<T> stream() {
|
|
|
- if (DONT_USE_FLAT_STREAM) {
|
|
|
+ if (RuntimeConfiguration.FIX_FLAT_STREAM()) {
|
|
|
return BaseIterable.stream(this);
|
|
|
}
|
|
|
return source.stream().flatMap(s -> p.test(s) ? f.apply(s).stream() : Stream.of(s));
|
|
|
@@ -258,7 +256,7 @@ public class BaseFlat {
|
|
|
|
|
|
@Override
|
|
|
public Stream<T> stream() {
|
|
|
- if (DONT_USE_FLAT_STREAM) {
|
|
|
+ if (RuntimeConfiguration.FIX_FLAT_STREAM()) {
|
|
|
return BaseIterable.stream(this);
|
|
|
}
|
|
|
return source.stream().flatMap(s -> {
|
|
|
@@ -311,7 +309,7 @@ public class BaseFlat {
|
|
|
|
|
|
@Override
|
|
|
public Stream<T> stream() {
|
|
|
- if (DONT_USE_FLAT_STREAM) {
|
|
|
+ if (RuntimeConfiguration.FIX_FLAT_STREAM()) {
|
|
|
return BaseIterable.stream(this);
|
|
|
}
|
|
|
return source.stream().flatMap(s -> {
|
|
|
@@ -371,7 +369,7 @@ public class BaseFlat {
|
|
|
|
|
|
@Override
|
|
|
public boolean hasFastStream() {
|
|
|
- return !DONT_USE_FLAT_STREAM && source.features().hasFastStream();
|
|
|
+ return !RuntimeConfiguration.FIX_FLAT_STREAM() && source.features().hasFastStream();
|
|
|
}
|
|
|
}
|
|
|
|