public static PersistentHashSet create(ISeq items) { PersistentHashSet ret = EMPTY; for (; items != null; items = items.next()) { ret = (PersistentHashSet) ret.cons(items.first()); } 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 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 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; }
public static 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; }
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 IPersistentCollection empty() { return EMPTY.withMeta(meta()); }