Libraryless. Click here for Pure Java version (2264L/14K/52K).
!7 p { CircularFifoBuffer<Character> b = new CircularFifoBuffer<Character>(4); b.add('k'); b.add('i'); b.add('l'); b.add('l'); b.add('l'); S s = getLast(b, 4); assertEqualsVerbose("illl", s); assertEqualsVerbose(1L, b.getBase()); } static S getLast(CircularFifoBuffer<Character> b, int n) { n = Math.min(n, b.size()); new StringBuilder buf; Iterator<Character> it = b.getBackingStore().descendingIterator(); for (int i = 0; i < n; i++) buf.append(it.next()); return buf.reverse().toString(); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1000775 |
Snippet name: | Test CircularFifoBuffer |
Eternal ID of this version: | #1000775/4 |
Text MD5: | a9e142d0b3d186b460de291db6c72ce9 |
Transpilation MD5: | c69dc56cb9fff4196d039f8131d549a5 |
Author: | stefan |
Category: | |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-19 23:32:47 |
Source code size: | 536 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 746 / 825 |
Version history: | 3 change(s) |
Referenced in: | [show references] |