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

8
LINES

< > BotCompany Repo | #1023732 // falsesFollowedByTrues_changeIndex_assertNotNull

JavaX fragment (include)

1  
static int falsesFollowedByTrues_changeIndex_assertNotNull(L<Bool> l) {
2  
  int i = 0, n = l(l);
3  
  while (i < n && isFalse(l.get(i))) ++i;
4  
  for (int j = i; j < n; j++)
5  
    if (!isTrue(l.get(i)))
6  
      fail("Not a false/true list: " + l);
7  
  ret i;
8  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023732
Snippet name: falsesFollowedByTrues_changeIndex_assertNotNull
Eternal ID of this version: #1023732/2
Text MD5: b82c9440544ed74348fe7804800adf97
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-07 18:47:17
Source code size: 254 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 234 / 276
Version history: 1 change(s)
Referenced in: [show references]