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

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

codecov-commenter commented on PR #2541:
URL: https://github.com/apache/groovy/pull/2541#issuecomment-4472873205

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2541?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `92.53731%` with `5 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 68.1790%. Comparing base 
([`1b70ef4`](https://app.codecov.io/gh/apache/groovy/commit/1b70ef49a30627c62375c24cfe60e4db03361a44?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`b42087f`](https://app.codecov.io/gh/apache/groovy/commit/b42087f115bca224371b39386cd470e4259387f6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 2 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2541?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[.../codehaus/groovy/runtime/DefaultGroovyMethods.java](https://app.codecov.io/gh/apache/groovy/pull/2541?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FDefaultGroovyMethods.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvRGVmYXVsdEdyb292eU1ldGhvZHMuamF2YQ==)
 | 91.9355% | [3 Missing and 2 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/2541?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2541/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2541?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2541        +/-   ##
   ==================================================
   + Coverage     68.1651%   68.1790%   +0.0138%     
   - Complexity      32860      32875        +15     
   ==================================================
     Files            1499       1499                
     Lines          125394     125461        +67     
     Branches        22665      22672         +7     
   ==================================================
   + Hits            85475      85538        +63     
   - Misses          32399      32403         +4     
     Partials         7520       7520                
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2541?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...rg/codehaus/groovy/runtime/ArrayGroovyMethods.java](https://app.codecov.io/gh/apache/groovy/pull/2541?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FArrayGroovyMethods.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvQXJyYXlHcm9vdnlNZXRob2RzLmphdmE=)
 | `89.8058% <100.0000%> (+0.0310%)` | :arrow_up: |
   | 
[.../codehaus/groovy/runtime/DefaultGroovyMethods.java](https://app.codecov.io/gh/apache/groovy/pull/2541?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FDefaultGroovyMethods.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvRGVmYXVsdEdyb292eU1ldGhvZHMuamF2YQ==)
 | `75.0495% <91.9355%> (+0.3014%)` | :arrow_up: |
   
   ... and [5 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2541/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> New GDK methods: zipWithNext and groupConsecutive
> -------------------------------------------------
>
>                 Key: GROOVY-12016
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12016
>             Project: Groovy
>          Issue Type: New Feature
>          Components: Extension methods
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>
> h2. {{zipWithNext}} 
> Add a {{zipWithNext}} GDK method returning successive adjacent pairs
> (a sliding window of size 2, step 1), plus an overload taking a
> combiner. Mirrors Kotlin's {{zipWithNext()}} / {{zipWithNext(transform)}}.
> Today this needs the non-obvious, off-by-one-prone {{collate(2, 1, false)}}.
> h3. Proposed signatures
> {code:java}
> List<Tuple2<T,T>>      zipWithNext(Iterable<T> self)
> <R> List<R>            zipWithNext(Iterable<T> self, BiFunction<? super T,? 
> super T,? extends R> combiner)
> Iterator<Tuple2<T,T>>  zipWithNext(Iterator<T> self)                 // lazy
> <R> Iterator<R>        zipWithNext(Iterator<T> self, BiFunction<? super T,? 
> super T,? extends R> combiner)
> List<Tuple2<T,T>>      zipWithNext(T[] self)
> <R> List<R>            zipWithNext(T[] self, BiFunction<? super T,? super T,? 
> extends R> combiner)
> {code}
> h3. Examples
> {code:groovy}
> [1, 2, 3, 4].zipWithNext()            == [new Tuple2(1,2), new Tuple2(2,3), 
> new Tuple2(3,4)]
> [1, 2, 3, 4].zipWithNext{ a,b -> b-a } == [1, 1, 1]            // pairwise 
> deltas
> [3,1,4,1,5].zipWithNext{ a,b -> a<=b }.every()  == false       // monotonic 
> check
> [].zipWithNext()  == []
> [42].zipWithNext() == []                                       // no adjacent 
> pair
> {code}
> h3. Notes
> Groovy closures coerce to {{BiFunction}}. Primitive-array overloads
> deferred (Tuple2 boxes anyway).
> h2. {{groupConsecutive}}
> Add a {{groupConsecutive}} GDK method splitting a sequence into maximal
> runs of adjacent "same" elements (order preserved; the same key may
> recur in separate runs). Unlike {{groupBy}} (a {{Map}}, global, loses
> order and run boundaries) there is no native equivalent today.
> h3. Proposed signatures
> {code:java}
> List<List<T>>      groupConsecutive(Iterable<T> self)                         
>                // default equality
> <K> List<List<T>>  groupConsecutive(Iterable<T> self, Function<? super T,? 
> extends K> keyFn)  // by derived key
> List<List<T>>      groupConsecutive(Iterable<T> self, BiPredicate<? super T,? 
> super T> sameRun)
> // + Iterator (lazy) and T[] receiver rows, same trio
> {code}
> h3. Examples
> {code:groovy}
> [1,1,2,2,2,3,1,1].groupConsecutive()        == [[1,1],[2,2,2],[3],[1,1]]   // 
> two separate [1,1] runs
> [1,1L,1.0,2,2].groupConsecutive()           == [[1,1L,1.0],[2,2]]          // 
> number-aware default
> ['apple','avocado','banana'].groupConsecutive{ it[0] } == 
> [['apple','avocado'],['banana']]
> xs.groupConsecutive{ a,b -> Objects.equals(a,b) }                          // 
> opt out to strict .equals()
> 'aaabbbcccd'.toList().groupConsecutive().collect{ [it[0], it.size()] }     // 
> run-length encoding
> {code}
> h3. Design notes
> * No-arg uses Groovy's number-aware equality ({{coercedEquals}}),
>   consistent with {{unique()}} and the set-algebra family (derived from
>   the DefaultGroovyMethods source; {{contains}}'s plain-equals is the
>   documented anomaly, not the model).
> * Opt out via the {{BiPredicate}} overload: {{Objects.equals}} for
>   strict, {{(a <=> b) == 0}} for natural-order/value equivalence,
>   {{cmp.compare(a,b)==0}} for a Comparator. A {{Comparator}} overload was
>   rejected: a boolean closure silently mis-coerces to it.
> * Arity-disambiguated overloads (0/1/2 params); no closure-arity sniffing.
> * {{dedupeConsecutive}} intentionally NOT included — it is
>   {{groupConsecutive()*.first()}} (cf. {{findAll}} with no {{rejectAll}}).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to