Skip to content

Commit

Permalink
add another possible infinite loop to Lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed Jun 10, 2024
1 parent 3e34591 commit 37faf4a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions enigma/src/test/java/org/quiltmc/enigma/input/lambdas/Lambdas.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Stream;

public class Lambdas {
Expand All @@ -12,6 +13,15 @@ public Stream<Lambdas> stream() {
return Stream.concat(Stream.of(this), this.children.stream().flatMap(Lambdas::stream));
}

public Stream<Lambdas> crazyStream() {
return get(() -> Stream.concat(Stream.of(this), this.children.stream().flatMap(Lambdas::crazyStream)));
}

public static Stream<Lambdas> get(Supplier<Stream<Lambdas>> provider) {
return provider.get();
}


public static void foo() {
consume(s -> consume(s1 -> {
System.out.println(s);
Expand Down

0 comments on commit 37faf4a

Please sign in to comment.