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

15
LINES

< > BotCompany Repo | #1033127 // listOfListsToMatrix

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

Libraryless. Click here for Pure Java version (3885L/22K).

static <A> Matrix<A> listOfListsToMatrix(LL<A> data) {
  if (data == null) null;
  int _h = l(data);
  if (_h == 0) null;
  int _w = l(data.get(0));

  class ListsToMatrix extends AbstractMatrix<A> {
    *() { super(_w, _h); }
  
    public A get(int x, int y) { ret data.get(y).get(x); }
    public void set(int x, int y, A a) { data.get(y).set(x, a); }
  };
  
  ret new ListsToMatrix;
}

Author comment

Began life as a copy of #1033120

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033127
Snippet name: listOfListsToMatrix
Eternal ID of this version: #1033127/2
Text MD5: 1afa23be4975756ca55282875c2a8702
Transpilation MD5: 2d6ac295cf90557ce1c1ecc411d3d7bb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-15 16:32:16
Source code size: 403 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 93 / 147
Version history: 1 change(s)
Referenced in: [show references]