DoubleStreamRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

Disable all rules by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$).* as compiler argument.

Table of contents
  1. DoubleStreamIdentity
  2. DoubleStreamConcat
  3. DoubleStreamFlatMapFilter
  4. StreamFlatMapToDoubleFilter
  5. DoubleStreamFlatMapMap
  6. StreamFlatMapToDoubleMap
  7. DoubleStreamFlatMapFlatMap
  8. StreamFlatMapToDoubleFlatMap
  9. DoubleStreamFilterSorted
  10. DoubleStreamFindAnyIsEmpty
  11. DoubleStreamFindAnyIsPresent
  12. DoubleStreamMin
  13. DoubleStreamNoneMatchWithDoublePredicate
  14. DoubleStreamNoneMatch
  15. DoubleStreamAnyMatch
  16. DoubleStreamAllMatchWithDoublePredicate
  17. DoubleStreamAllMatch
  18. DoubleStreamTakeWhile

DoubleStreamIdentity

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamIdentity") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamIdentity).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testDoubleStreamIdentity() {
-  return Streams.concat(DoubleStream.of(1));
+  return DoubleStream.of(1);
 }

DoubleStreamConcat

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamConcat") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamConcat).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testDoubleStreamConcat() {
-  return Streams.concat(DoubleStream.of(1), DoubleStream.of(2));
+  return DoubleStream.concat(DoubleStream.of(1), DoubleStream.of(2));
 }

DoubleStreamFlatMapFilter

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamFlatMapFilter") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamFlatMapFilter).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testDoubleStreamFlatMapFilter() {
-  return DoubleStream.of(1).flatMap(v -> DoubleStream.of(v * v).filter(n -> n > 1));
+  return DoubleStream.of(1).flatMap(v -> DoubleStream.of(v * v)).filter(n -> n > 1);
 }

StreamFlatMapToDoubleFilter

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("StreamFlatMapToDoubleFilter") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$StreamFlatMapToDoubleFilter).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testStreamFlatMapToDoubleFilter() {
-  return Stream.of(1).flatMapToDouble(v -> DoubleStream.of(v * v).filter(n -> n > 1));
+  return Stream.of(1).flatMapToDouble(v -> DoubleStream.of(v * v)).filter(n -> n > 1);
 }

DoubleStreamFlatMapMap

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamFlatMapMap") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamFlatMapMap).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testDoubleStreamFlatMapMap() {
-  return DoubleStream.of(1).flatMap(v -> DoubleStream.of(v * v).map(n -> n * 1));
+  return DoubleStream.of(1).flatMap(v -> DoubleStream.of(v * v)).map(n -> n * 1);
 }

StreamFlatMapToDoubleMap

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("StreamFlatMapToDoubleMap") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$StreamFlatMapToDoubleMap).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testStreamFlatMapToDoubleMap() {
-  return Stream.of(1).flatMapToDouble(v -> DoubleStream.of(v * v).map(n -> n * 1));
+  return Stream.of(1).flatMapToDouble(v -> DoubleStream.of(v * v)).map(n -> n * 1);
 }

DoubleStreamFlatMapFlatMap

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamFlatMapFlatMap") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamFlatMapFlatMap).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testDoubleStreamFlatMapFlatMap() {
-  return DoubleStream.of(1).flatMap(v -> DoubleStream.of(v * v).flatMap(DoubleStream::of));
+  return DoubleStream.of(1).flatMap(v -> DoubleStream.of(v * v)).flatMap(DoubleStream::of);
 }

StreamFlatMapToDoubleFlatMap

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("StreamFlatMapToDoubleFlatMap") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$StreamFlatMapToDoubleFlatMap).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testStreamFlatMapToDoubleFlatMap() {
-  return Stream.of(1).flatMapToDouble(v -> DoubleStream.of(v * v).flatMap(DoubleStream::of));
+  return Stream.of(1).flatMapToDouble(v -> DoubleStream.of(v * v)).flatMap(DoubleStream::of);
 }

DoubleStreamFilterSorted

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamFilterSorted") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamFilterSorted).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testDoubleStreamFilterSorted() {
-  return DoubleStream.of(1).sorted().filter(d -> d > 0);
+  return DoubleStream.of(1).filter(d -> d > 0).sorted();
 }

DoubleStreamFindAnyIsEmpty

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamFindAnyIsEmpty") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamFindAnyIsEmpty).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testDoubleStreamFindAnyIsEmpty() {
   return ImmutableSet.of(
-      DoubleStream.of(1).count() == 0,
-      DoubleStream.of(2).count() <= 0,
-      DoubleStream.of(3).count() < 1,
-      DoubleStream.of(4).findFirst().isEmpty());
+      DoubleStream.of(1).findAny().isEmpty(),
+      DoubleStream.of(2).findAny().isEmpty(),
+      DoubleStream.of(3).findAny().isEmpty(),
+      DoubleStream.of(4).findAny().isEmpty());
 }

DoubleStreamFindAnyIsPresent

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamFindAnyIsPresent") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamFindAnyIsPresent).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testDoubleStreamFindAnyIsPresent() {
   return ImmutableSet.of(
-      DoubleStream.of(1).count() != 0,
-      DoubleStream.of(2).count() > 0,
-      DoubleStream.of(3).count() >= 1,
-      DoubleStream.of(4).findFirst().isPresent());
+      DoubleStream.of(1).findAny().isPresent(),
+      DoubleStream.of(2).findAny().isPresent(),
+      DoubleStream.of(3).findAny().isPresent(),
+      DoubleStream.of(4).findAny().isPresent());
 }

DoubleStreamMin

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamMin") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamMin).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 OptionalDouble testDoubleStreamMin() {
-  return DoubleStream.of(1).sorted().findFirst();
+  return DoubleStream.of(1).min();
 }

DoubleStreamNoneMatchWithDoublePredicate

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamNoneMatchWithDoublePredicate") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamNoneMatchWithDoublePredicate).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testDoubleStreamNoneMatchWithDoublePredicate() {
   DoublePredicate pred = i -> i > 0;
   return ImmutableSet.of(
-      !DoubleStream.of(1).anyMatch(n -> n > 1),
-      DoubleStream.of(2).allMatch(pred.negate()),
-      DoubleStream.of(3).filter(pred).findAny().isEmpty());
+      DoubleStream.of(1).noneMatch(n -> n > 1),
+      DoubleStream.of(2).noneMatch(pred),
+      DoubleStream.of(3).noneMatch(pred));
 }

DoubleStreamNoneMatch

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamNoneMatch") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamNoneMatch).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 boolean testDoubleStreamNoneMatch() {
-  return DoubleStream.of(1).allMatch(n -> !(n > 1));
+  return DoubleStream.of(1).noneMatch(n -> n > 1);
 }

DoubleStreamAnyMatch

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamAnyMatch") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamAnyMatch).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<Boolean> testDoubleStreamAnyMatch() {
   return ImmutableSet.of(
-      !DoubleStream.of(1).noneMatch(n -> n > 1),
-      DoubleStream.of(2).filter(n -> n > 2).findAny().isPresent());
+      DoubleStream.of(1).anyMatch(n -> n > 1), DoubleStream.of(2).anyMatch(n -> n > 2));
 }

DoubleStreamAllMatchWithDoublePredicate

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamAllMatchWithDoublePredicate") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamAllMatchWithDoublePredicate).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 boolean testDoubleStreamAllMatchWithDoublePredicate() {
   DoublePredicate pred = i -> i > 0;
-  return DoubleStream.of(1).noneMatch(pred.negate());
+  return DoubleStream.of(1).allMatch(pred);
 }

DoubleStreamAllMatch

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamAllMatch") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamAllMatch).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 boolean testDoubleStreamAllMatch() {
-  return DoubleStream.of(1).noneMatch(n -> !(n > 1));
+  return DoubleStream.of(1).allMatch(n -> n > 1);
 }

DoubleStreamTakeWhile

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DoubleStreamTakeWhile") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DoubleStreamRules\$DoubleStreamTakeWhile).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 DoubleStream testDoubleStreamTakeWhile() {
-  return DoubleStream.of(1, 2, 3).takeWhile(i -> i < 2).filter(i -> i < 2);
+  return DoubleStream.of(1, 2, 3).takeWhile(i -> i < 2);
 }

Copyright © 2017-2026 Picnic Technologies BV