MCPcopy Index your code
hub / github.com/ccxt/ccxt / Extend

Method Extend

java/lib/src/main/java/io/github/ccxt/base/Generic.java:158–176  ·  view source on GitHub ↗
(Object aa, Object bb)

Source from the content-addressed store, hash-verified

156 }
157
158 public static Map<String, Object> Extend(Object aa, Object bb) {
159 Map<String, Object> a = (Map<String, Object>) aa;
160 Map<String, Object> out = new LinkedHashMap<>();
161 // Snapshot the source maps before iterating: callers commonly pass
162 // shared state like Exchange.options (Collections.synchronizedMap-wrapped)
163 // that another thread may be writing concurrently. Iterating directly
164 // would throw ConcurrentModificationException; the snapshot is cheap
165 // and decouples us from the caller's locking discipline.
166 for (Map.Entry<String, Object> e : snapshotEntries(a)) {
167 out.put(e.getKey(), e.getValue());
168 }
169 if (bb != null) {
170 Map<String, Object> b = (Map<String, Object>) bb;
171 for (Map.Entry<String, Object> e : snapshotEntries(b)) {
172 out.put(e.getKey(), e.getValue());
173 }
174 }
175 return out;
176 }
177
178 private static List<Map.Entry<String, Object>> snapshotEntries(Map<String, Object> map) {
179 // synchronized() is a no-op for an unwrapped HashMap and the correct

Callers 1

extendMethod · 0.95

Calls 2

snapshotEntriesMethod · 0.95
getValueMethod · 0.45

Tested by

no test coverage detected