예제 #1
0
  // Taken from clojure.lang.APersistentMap
  public IPersistentCollection cons(Object o) {
    if (o instanceof Map.Entry) {
      Map.Entry e = (Map.Entry) o;
      return assoc(e.getKey(), e.getValue());
    } else if (o instanceof IPersistentVector) {
      IPersistentVector v = (IPersistentVector) o;
      if (v.count() != 2) {
        throw new IllegalArgumentException("Vector arg to temporal conj must be a pair");
      }
      return assoc(v.nth(0), v.nth(1));
    }

    IPersistentMap ret = this;
    for (ISeq es = RT.seq(o); es != null; es = es.next()) {
      Map.Entry e = (Map.Entry) es.first();
      ret = ret.assoc(e.getKey(), e.getValue());
    }
    return ret;
  }
예제 #2
0
 private Object getValueByPointer(ValuePointer ptr) {
   return ((List<Object>) _delegates.nth(ptr.delegateIndex)).get(ptr.index);
 }