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

12
LINES

< > BotCompany Repo | #1033641 // mapMatrix

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

Libraryless. Click here for Pure Java version (5433L/30K).

static <A, B> Matrix<B> lambdaMapLike mapMatrix(IF1<A, B> f, Matrix<A> m) {
  if (m == null) null;
  
  class MappedMatrix extends AbstractMatrix<B> {
    *() { super(m.getWidth(), m.getHeight()); }
    
    public B get(int x, int y) { ret f.get(m.get(x, y)); }
    public void set(int x, int y, B a) { unimplemented(); }
  }
  
  ret new MappedMatrix;
}

Author comment

Began life as a copy of #1003239

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1033641
Snippet name: mapMatrix
Eternal ID of this version: #1033641/4
Text MD5: 6af22ce7913fa16d679e71c96ab0253a
Transpilation MD5: 0bdd2f1e61adcf9580c4d4075850fafc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-25 17:25:03
Source code size: 366 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 96 / 138
Version history: 3 change(s)
Referenced in: [show references]