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

11
LINES

< > BotCompany Repo | #1010877 // wordsMatrix

JavaX fragment (include)

1  
static S[][] wordsMatrix(Collection<S> lines) {
2  
  LL<S> l = map words(lines);
3  
  int rows = l(l), cols = maxLength(l);
4  
  S[][] matrix = new S[rows][cols];
5  
  for i to rows: {
6  
    L<S> words = l.get(i);
7  
    for j to cols:
8  
      matrix[i][j] = j < l(words) ? words.get(j) : "";
9  
  }
10  
  ret matrix;
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010877
Snippet name: wordsMatrix
Eternal ID of this version: #1010877/2
Text MD5: f23be07403b32b9029cadd9d3fb73162
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-05 00:20:37
Source code size: 303 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 367 / 385
Version history: 1 change(s)
Referenced in: [show references]