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

11
LINES

< > BotCompany Repo | #1013100 // LatestList - fixed-size list (up to) of last added elements

JavaX fragment (include)

sclass LatestList<A> extends LinkedList<A> {
  int limit;

  *(int *limit) {}

  public bool add(A o) {
    if (limit == 0) true;
    while (size() >= limit) super.remove();
    ret super.add(o);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013100
Snippet name: LatestList - fixed-size list (up to) of last added elements
Eternal ID of this version: #1013100/3
Text MD5: f884cfbc89180cf8b7bd66a6abcdd1e4
Author: stefan
Category: javax / chat
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-25 20:57:06
Source code size: 211 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 383 / 930
Version history: 2 change(s)
Referenced in: [show references]