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.

sclass RunLengthCounter<A> {
  gettable A value;
  gettable long runLength;
  
  long add(A value) {
    if (eq(this.value, value))
      ++runLength;
    else
      runLength = 1;
    this.value = value;
    ret runLength;
  }
}

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: 106 / 162
Version history: 1 change(s)
Referenced in: [show references]