posted 9 months ago
Thanks for the example - it helped me realize that accept could be called more than once - that lets me avoid needing to collect downstream elements in a temporary collection when using flatMap.
For example - I have an annotation which defines what types of content a class can process:
In order to work-around some issues using Graalvm to create a native executable, I need to extract and transform to the information in annotations at Graalvm's build time. For each annotation in, there could be multiple elements out. In the example below, I collected the elements to a List, returned it as a stream, and then flattened it using flatMap:
Using mapMulti, I can eliminate the List: