Libraryless. Click here for Pure Java version (2241L/14K).
final sclass SparseIntArray2D implements IIntArray2D { int nrows, ncols; new HashMap<Pt, Int> entries; *() {} *(int *nrows, int *ncols) {} public int nrows() { ret nrows; } public int ncols() { ret ncols; } /** Returns A(i, j). */ public int get(int i, int j) { ret or0(entries.get(Pt(i, j)); } /** Sets A(i, j). */ public int set(int i, int j, int x) { if (x == 0) entries.remove(Pt(i, j)); else entries.put(Pt(i, j), x); ret x; } }
Began life as a copy of #1026139
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1026140 |
Snippet name: | SparseIntArray2D |
Eternal ID of this version: | #1026140/5 |
Text MD5: | 30095902ee746da7e3a570616eb2027a |
Transpilation MD5: | d1f98b210bbb67aef713775303c379ee |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-11-27 03:01:10 |
Source code size: | 516 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 220 / 580 |
Version history: | 4 change(s) |
Referenced in: | [show references] |