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

20
LINES

< > BotCompany Repo | #1033710 // wrapLongBufferAsPtList

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

Libraryless. Click here for Pure Java version (5210L/29K).

static L<Pt> wrapLongBufferAsPtList(LongBuffer buf default new LongBuffer) {
  ret new RandomAccessAbstractList<Pt>() {
    public int size() { ret buf.size(); }
    
    public Pt get(int i) {
      ret longToPt(buf.get(i));
    }
    
    public Pt set(int i, Pt val) {
      Pt old = get(i);
      buf.set(i, ptToLong(val));
      ret old;
    }
    
    public bool add(Pt p) {
      buf.add(ptToLong(p));
      true;
    }
  };
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033710
Snippet name: wrapLongBufferAsPtList
Eternal ID of this version: #1033710/4
Text MD5: f92453ddda63ed6b42f5b38ca2bb9354
Transpilation MD5: cd524b951bb9d2bef35ca7911b61cc6b
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-01 22:36:13
Source code size: 453 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 69 / 117
Version history: 3 change(s)
Referenced in: [show references]