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

11
LINES

< > BotCompany Repo | #1036448 // valuesArray - values of map as array

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

Libraryless. Click here for Pure Java version (9992L/54K).

static <A, B> B[] valuesArray(Class<B> valueType, Map<A, B> map) {
  if (map == null) null;
  synchronized(collectionMutex(map)) {
    int n = map.size();
    B[] array = newArray(valueType, n);
    var it = valueIterator(map);
    for i to n:
      array[i] = it.next();
    ret array;
  }
}

Author comment

Began life as a copy of #1004212

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036448
Snippet name: valuesArray - values of map as array
Eternal ID of this version: #1036448/3
Text MD5: e1073a3a49502944674f41b54c5d40c5
Transpilation MD5: 8f827695690e8ea2f1436919354a4d73
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-15 16:21:38
Source code size: 304 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 173 / 225
Version history: 2 change(s)
Referenced in: [show references]