本文整理汇总了Java中clojure.lang.IPersistentSet类的典型用法代码示例。如果您正苦于以下问题:Java IPersistentSet类的具体用法?Java IPersistentSet怎么用?Java IPersistentSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPersistentSet类属于clojure.lang包,在下文中一共展示了IPersistentSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: remove
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public JmhSetMultimap remove(JmhValue key, JmhValue value) {
Object singletonOrSet = xs.valAt(key);
if (singletonOrSet == null) {
return this;
} else if (singletonOrSet instanceof IPersistentSet) {
IPersistentSet oldSet = (IPersistentSet) singletonOrSet;
IPersistentSet newSet = oldSet.disjoin(value);
switch (newSet.count()) {
case 0:
return new ClojureSetMultimap(xs.without(key));
case 1:
return new ClojureSetMultimap(xs.assoc(key, newSet.seq().first()));
default:
return new ClojureSetMultimap(xs.assoc(key, newSet));
}
} else {
if (singletonOrSet.equals(value)) {
return new ClojureSetMultimap(xs.without(key));
} else {
return this;
}
}
}
示例2: done
import clojure.lang.IPersistentSet; //导入依赖的package包/类
public ISet done(){
ITransientCollection ret = PersistentHashSet.EMPTY.asTransient();
for(Object item : data)
ret = ret.conj(item);
IPersistentSet persistentData = (IPersistentSet) ret.persistent();
if (constructedSet == null) {
constructedSet = new Set(elementType, persistentData);
}
return constructedSet;
}
示例3: intoClojureSet
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> ClojureSet<T> intoClojureSet(Set<? extends T> set) {
if (set instanceof ClojureSet) return (ClojureSet<T>) set;
if (set instanceof IPersistentSet) return (ClojureSet<T>) ClojureSet.wrap((IPersistentSet) set);
// Work around an inference bug in some older JDKs
Collector<T, TransientSet<T>, ClojureSet<T>> collector = toClojureSet();
return set.stream().collect(collector);
}
示例4: contains
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public boolean contains(JmhValue key, JmhValue value) {
Object singletonOrSet = xs.valAt(key);
if (singletonOrSet == null) {
return false;
} else if (singletonOrSet instanceof IPersistentSet) {
IPersistentSet set = (IPersistentSet) singletonOrSet;
return set.contains(value);
} else {
return singletonOrSet.equals(value);
}
}
示例5:
import clojure.lang.IPersistentSet; //导入依赖的package包/类
public final static IPersistentSet set$union(IPersistentSet xs, IPersistentSet ys) {
return (IPersistentSet) set$union.invoke(xs, ys);
}
示例6: Set
import clojure.lang.IPersistentSet; //导入依赖的package包/类
protected Set(Type et, IPersistentSet xs) {
this.ct = inferSetOrRelType(et, xs.count() == 0);
this.xs = xs;
}
示例7: insert
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet insert(IValue x) {
return new Set(lub(x), (IPersistentSet) xs.cons(x));
}
示例8: done
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet done() {
IPersistentSet result = (IPersistentSet) xs.persistent();
return new Set(et, result);
}
示例9: TypelessCljDsSet
import clojure.lang.IPersistentSet; //导入依赖的package包/类
protected TypelessCljDsSet(IPersistentSet xs) {
this.xs = xs;
}
示例10: insert
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet insert(IValue x) {
return new TypelessCljDsSet((IPersistentSet) xs.cons(x));
}
示例11: done
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet done() {
IPersistentSet result = (IPersistentSet) xs.persistent();
return new TypelessCljDsSet(result);
}
示例12: toPersistent
import clojure.lang.IPersistentSet; //导入依赖的package包/类
/**
* Returns a persistent immutable version of this TransientSet. This operation is performed in
* constant time. Note that after this method is called, this transient instance will no longer
* be usable and attempts to modify it will fail.
*/
public ClojureSet<T> toPersistent() {
IPersistentCollection persistent = delegate.persistent();
IPersistentSet asSet = (IPersistentSet) persistent;
return ClojureSet.wrap(asSet);
}
示例13: wrap
import clojure.lang.IPersistentSet; //导入依赖的package包/类
static <T> ClojureSet<T> wrap(IPersistentSet clojureSet) {
return create(clojureSet);
}
示例14: create
import clojure.lang.IPersistentSet; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> ClojureSet<T> create(IPersistentSet ts) {
return new ClojureSet<>(ts);
}
示例15: with
import clojure.lang.IPersistentSet; //导入依赖的package包/类
/**
* Returns a copy of this set that includes {@code t}.
*/
public ClojureSet<T> with(T t) {
return ClojureSet.create((IPersistentSet) ((IPersistentSet) delegate).cons(t));
}