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).

1  
static <A, B> B[] valuesArray(Class<B> valueType, Map<A, B> map) {
2  
  if (map == null) null;
3  
  synchronized(collectionMutex(map)) {
4  
    int n = map.size();
5  
    B[] array = newArray(valueType, n);
6  
    var it = valueIterator(map);
7  
    for i to n:
8  
      array[i] = it.next();
9  
    ret array;
10  
  }
11  
}

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: 175 / 229
Version history: 2 change(s)
Referenced in: [show references]