You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/06/26 22:06:00 UTC

[jira] [Commented] (GROOVY-10473) Extend streams support to spread and subscript

    [ https://issues.apache.org/jira/browse/GROOVY-10473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17558928#comment-17558928 ] 

ASF GitHub Bot commented on GROOVY-10473:
-----------------------------------------

eric-milles opened a new pull request, #1733:
URL: https://github.com/apache/groovy/pull/1733

   `IntStream`, `LongStream`, and `DoubleStream` do not have safe default for `getAt(int)`.  They could have `getAt(IntRange)` added safely.  I don't think `getAt(Range)` or `getAt(EmptyRange)` of `getAt(ObjectRange)` are necessary.
   
   https://issues.apache.org/jira/browse/GROOVY-10473




> Extend streams support to spread and subscript
> ----------------------------------------------
>
>                 Key: GROOVY-10473
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10473
>             Project: Groovy
>          Issue Type: Improvement
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> Groovy 3 and 4 added some {{Stream}} extension methods like {{plus}}, {{toList}} and {{toArray}}.  And some default type conversions like {{String[] array = stream;}}.  This could be taken further by having spread-dot and subscript support:
> {code:groovy}
> stream*.thing // --> stream.map(it -> it.thing).toList()
> stream[1] // --> stream.skip(1).findFirst().orElse(null)
> stream[1..10] // --> stream.skip(1).limit(10-1).toList()
> // consider negative indexes and reverse ranges
> {code}
> Also, {{forEachPair}} and {{zip}} extension methods would be useful for processing corresponding streams.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)