public static PersistentHashSet create(Object... init){ PersistentHashSet ret = EMPTY; for(int i = 0; i < init.length; i++) { ret = (PersistentHashSet) ret.cons(init[i]); } return ret; }
public static PersistentHashSet create(List init){ PersistentHashSet ret = EMPTY; for(Object key : init) { ret = (PersistentHashSet) ret.cons(key); } return ret; }
public static PersistentHashSet createWithCheck(List init){ PersistentHashSet ret = EMPTY; int i=0; for(Object key : init) { ret = (PersistentHashSet) ret.cons(key); if(ret.count() != i + 1) throw new IllegalArgumentException("Duplicate key: " + key); ++i; } return ret; }
public static PersistentHashSet createWithCheck(Object... init){ PersistentHashSet ret = EMPTY; for(int i = 0; i < init.length; i++) { ret = (PersistentHashSet) ret.cons(init[i]); if(ret.count() != i + 1) throw new IllegalArgumentException("Duplicate key: " + init[i]); } return ret; }
static public PersistentHashSet create(ISeq items){ PersistentHashSet ret = EMPTY; for(; items != null; items = items.next()) { ret = (PersistentHashSet) ret.cons(items.first()); } return ret; }
static public PersistentHashSet createWithCheck(ISeq items){ PersistentHashSet ret = EMPTY; for(int i=0; items != null; items = items.next(), ++i) { ret = (PersistentHashSet) ret.cons(items.first()); if(ret.count() != i + 1) throw new IllegalArgumentException("Duplicate key: " + items.first()); } return ret; }
@Override public Type union(Type t) { if (t==this) return t; if (t instanceof Value) { Object value=((Value<?>)t).value; if (values.contains(value)) { return this; } else { return update((PersistentHashSet) values.cons(value)); } } return super.union(t); }
static void closeOver(LocalBinding b, ObjMethod method){ if(b != null && method != null) { if(RT.get(method.locals, b) == null) { method.objx.closes = (IPersistentMap) RT.assoc(method.objx.closes, b, b); closeOver(b, method.parent); } else if(IN_CATCH_FINALLY.deref() != null) { method.localsUsedInCatchFinally = (PersistentHashSet) method.localsUsedInCatchFinally.cons(b.idx); } } }