protected boolean insert_new_many(final ESeq values) {
// Input verification outside of transaction:
for (ESeq seq = values; !seq.isNil(); seq = seq.tail()) {
ETuple value = seq.head().testTuple();
if (value == null) throw ERT.badarg(values);
EObject key = get_key(value);
}
return in_tx(new WithMap<Boolean>() {
@Override
protected Boolean run(IPersistentMap map) {
for (ESeq seq = values; !seq.isNil(); seq = seq.tail()) {
ETuple value = seq.head().testTuple();
EObject key = get_key(value);
if (map.containsKey(key)) {
return false;
}
}
for (ESeq seq = values; !seq.isNil(); seq = seq.tail()) {
ETuple value = seq.head().testTuple();
EObject key = get_key(value);
map = map.assoc(key, value);
}
set(map);
return true;