예제 #1
0
 public static PersistentHashSet create(ISeq items) {
   PersistentHashSet ret = EMPTY;
   for (; items != null; items = items.next()) {
     ret = (PersistentHashSet) ret.cons(items.first());
   }
   return ret;
 }
예제 #2
0
 public static PersistentHashSet create(List init) {
   PersistentHashSet ret = EMPTY;
   for (Object key : init) {
     ret = (PersistentHashSet) ret.cons(key);
   }
   return ret;
 }
예제 #3
0
 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;
 }
예제 #4
0
 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;
 }
예제 #5
0
 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;
 }
예제 #6
0
 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;
 }
예제 #7
0
 public IPersistentCollection empty() {
   return EMPTY.withMeta(meta());
 }