Snapshot-copy of a Map's keys under the map's intrinsic lock, so concurrent put/remove from a WS-handler thread doesn't IOOBE the iteration. Used by the transpile of `Object.keys(x)` — see post-process in build/javaTranspiler.ts. For non-Map targets returns an empty list (matches JS Object.keys on n
(Object target)
| 953 | * For non-Map targets returns an empty list (matches JS Object.keys on non-objects). |
| 954 | */ |
| 955 | public static List<Object> objectKeys(Object target) { |
| 956 | if (target instanceof Map<?, ?> m) { |
| 957 | synchronized (m) { |
| 958 | return new ArrayList<>(m.keySet()); |
| 959 | } |
| 960 | } |
| 961 | return new ArrayList<>(); |
| 962 | } |
| 963 | |
| 964 | /** Same as {@link #objectKeys} but for values — transpile of `Object.values(x)`. */ |
| 965 | public static List<Object> objectValues(Object target) { |
no outgoing calls