Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1035606 // genericStreaks

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (9275L) is out of date.

static L<IntRange> lambdaMapLike genericStreaks(IIntPred pred, int n) {
  new L<IntRange> out;
  int i = 0;
  while (i < n) {
    int j = i;
    while (j < n && pred.get(j)) ++j;
    if (j > i)
      out.add(intRange(i, j));
    i = j+1;
  }
  ret out;
}

static L<IntRange> lambdaMapLike genericStreaks(int n, IIntPred pred) {
  ret genericStreaks(pred, n);
}

Author comment

Began life as a copy of #1019037

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035606
Snippet name: genericStreaks
Eternal ID of this version: #1035606/2
Text MD5: 460868082754ab65532217f55ad760e8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-06-26 18:37:44
Source code size: 371 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 135 / 166
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)