Libraryless. Click here for Pure Java version (2862L/17K).
1 | static Pair<Class, Int> arrayTypeAndDimensions(O o) { |
2 | ret arrayTypeAndDimensions(_getClass(o)); |
3 | } |
4 | |
5 | static Pair<Class, Int> arrayTypeAndDimensions(Class c) { |
6 | if (c == null || !c.isArray()) null; |
7 | Class elem = c.getComponentType(); |
8 | if (elem.isArray()) |
9 | ret mapPairB(arrayTypeAndDimensions(elem), dim -> dim+1); |
10 | ret pair(elem, 1); |
11 | } |
Began life as a copy of #1018917
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031246 |
Snippet name: | arrayTypeAndDimensions - get type of innermost element plus the arrays number of dimensions |
Eternal ID of this version: | #1031246/2 |
Text MD5: | 82ef786efeb162709d9747e11f39f303 |
Transpilation MD5: | 3e33712f4a70a8aea4d06de3a84f8ee9 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-05-25 17:40:20 |
Source code size: | 351 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 215 / 296 |
Version history: | 1 change(s) |
Referenced in: | [show references] |