RFR: 8252399: Update mapMulti documentation to use type test pattern instead of instanceof once JEP 375 exits preview [v7]

Patrick Concannon pconcannon at openjdk.java.net
Mon Mar 1 10:16:06 UTC 2021


On Wed, 24 Feb 2021 19:26:02 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> Patrick Concannon has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8252399: Converted JavadocExamples to test
>
> src/java.base/share/classes/java/util/stream/Stream.java line 414:
> 
>> 412:      *     }
>> 413:      * }
>> 414:      * }</pre>
> 
> I'd suggest putting a comment somewhere outside the javadoc that points to the test and has a statement similar to the one in the test, about keeping the example here in synch with the test. I'm not sure what the best way is to do this though. It probably cannot be after the javadoc comment, because the javadoc comment needs to be immediately prior to the method declaration. Maybe a // comment above the doc comment?

Good idea. I've added a comment above the javadoc as you've suggested. See 
944c7d5

> src/java.base/share/classes/java/util/stream/Stream.java line 410:
> 
>> 408:      *
>> 409:      *     public static void main(String[] args) {
>> 410:      *         var nestedList = ...;
> 
> I think it would be good to expand the RHS to use what you use in the test, namely
> 
> var nestedList = List.of(1, List.of(2, List.of(3, 4)), 5);
> 
> That would clarify the example quite a bit. Similar for the numbers example above.

Sounds good. I've added that to the example now. See 944c7d5

-------------

PR: https://git.openjdk.java.net/jdk/pull/2544


More information about the core-libs-dev mailing list