MCPcopy Index your code
hub / github.com/clojure/clojure / conj

Method conj

src/jvm/clojure/lang/ATransientMap.java:25–48  ·  view source on GitHub ↗
(Object o)

Source from the content-addressed store, hash-verified

23 abstract IPersistentMap doPersistent();
24
25 public ITransientMap conj(Object o) {
26 ensureEditable();
27 if(o instanceof Map.Entry)
28 {
29 Map.Entry e = (Map.Entry) o;
30
31 return assoc(e.getKey(), e.getValue());
32 }
33 else if(o instanceof IPersistentVector)
34 {
35 IPersistentVector v = (IPersistentVector) o;
36 if(v.count() != 2)
37 throw new IllegalArgumentException("Vector arg to map conj must be a pair");
38 return assoc(v.nth(0), v.nth(1));
39 }
40
41 ITransientMap ret = this;
42 for(ISeq es = RT.seq(o); es != null; es = es.next())
43 {
44 Map.Entry e = (Map.Entry) es.first();
45 ret = ret.assoc(e.getKey(), e.getValue());
46 }
47 return ret;
48 }
49
50 public final Object invoke(Object arg1) {
51 return valAt(arg1);

Callers

nothing calls this directly

Calls 10

ensureEditableMethod · 0.95
assocMethod · 0.95
seqMethod · 0.95
nextMethod · 0.95
firstMethod · 0.95
assocMethod · 0.95
countMethod · 0.65
nthMethod · 0.65
getKeyMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected