Search code examples
javastack-overflowfunctional-java

FunctionalJava app throws StackOverflowError with Stream in stack trace


FunctionalJava app throws StackOverflowError with Stream in stack trace, but the app doesn't (seemingly) use stream. What could be the cause?


Solution

  • Possibly some other datastructure is useing Stream behind the scenes, which can use massive recursion.

    The suspect in my case was IterableW, when using wrap and bind on native Java Iterables. Instead that, I used fj.List.iterableList to convert a finite Iterable to a fj.List, which has effective bind operation.