Libraryless. Click here for Pure Java version (3885L/22K).
1 | static <A> Matrix<A> listOfListsToMatrix(LL<A> data) {
|
2 | if (data == null) null; |
3 | int _h = l(data); |
4 | if (_h == 0) null; |
5 | int _w = l(data.get(0)); |
6 | |
7 | class ListsToMatrix extends AbstractMatrix<A> {
|
8 | *() { super(_w, _h); }
|
9 | |
10 | public A get(int x, int y) { ret data.get(y).get(x); }
|
11 | public void set(int x, int y, A a) { data.get(y).set(x, a); }
|
12 | }; |
13 | |
14 | ret new ListsToMatrix; |
15 | } |
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: | 391 / 514 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |