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

13
LINES

< > BotCompany Repo | #1036266 // RunLengthCounter

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

Transpiled version (9515L) is out of date.

1  
sclass RunLengthCounter<A> {
2  
  gettable A value;
3  
  gettable long runLength;
4  
  
5  
  long add(A value) {
6  
    if (eq(this.value, value))
7  
      ++runLength;
8  
    else
9  
      runLength = 1;
10  
    this.value = value;
11  
    ret runLength;
12  
  }
13  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036266
Snippet name: RunLengthCounter
Eternal ID of this version: #1036266/2
Text MD5: 913040ee7db0e8ad1f40f04e04fdb424
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-11-06 18:41:11
Source code size: 241 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 108 / 165
Version history: 1 change(s)
Referenced in: [show references]