当前位置: 首页>>代码示例>>Java>>正文


Java IPersistentSet类代码示例

本文整理汇总了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;
    }
  }
}
 
开发者ID:msteindorfer,项目名称:criterion,代码行数:27,代码来源:ClojureSetMultimap.java

示例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;
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:14,代码来源:FastSetWriter.java

示例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);
}
 
开发者ID:rschmitt,项目名称:collider,代码行数:11,代码来源:Collider.java

示例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);
  }
}
 
开发者ID:msteindorfer,项目名称:criterion,代码行数:14,代码来源:ClojureSetMultimap.java

示例5:

import clojure.lang.IPersistentSet; //导入依赖的package包/类
public final static IPersistentSet set$union(IPersistentSet xs, IPersistentSet ys) {
	return (IPersistentSet) set$union.invoke(xs, ys);
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:4,代码来源:ClojureHelper.java

示例6: Set

import clojure.lang.IPersistentSet; //导入依赖的package包/类
protected Set(Type et, IPersistentSet xs) {
	this.ct = inferSetOrRelType(et, xs.count() == 0);
	this.xs = xs;
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:5,代码来源:Set.java

示例7: insert

import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet insert(IValue x) {
	return new Set(lub(x), (IPersistentSet) xs.cons(x));
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:5,代码来源:Set.java

示例8: done

import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet done() {
	IPersistentSet result = (IPersistentSet) xs.persistent();
	return new Set(et, result);
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:6,代码来源:SetWriter.java

示例9: TypelessCljDsSet

import clojure.lang.IPersistentSet; //导入依赖的package包/类
protected TypelessCljDsSet(IPersistentSet xs) {
	this.xs = xs;
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:4,代码来源:TypelessCljDsSet.java

示例10: insert

import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet insert(IValue x) {
	return new TypelessCljDsSet((IPersistentSet) xs.cons(x));
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:5,代码来源:TypelessCljDsSet.java

示例11: done

import clojure.lang.IPersistentSet; //导入依赖的package包/类
@Override
public ISet done() {
	IPersistentSet result = (IPersistentSet) xs.persistent();
	return new TypelessCljDsSet(result);
}
 
开发者ID:msteindorfer,项目名称:oopsla15-artifact,代码行数:6,代码来源:TypelessCljDsSetWriter.java

示例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);
}
 
开发者ID:rschmitt,项目名称:collider,代码行数:11,代码来源:TransientSet.java

示例13: wrap

import clojure.lang.IPersistentSet; //导入依赖的package包/类
static <T> ClojureSet<T> wrap(IPersistentSet clojureSet) {
    return create(clojureSet);
}
 
开发者ID:rschmitt,项目名称:collider,代码行数:4,代码来源:ClojureSet.java

示例14: create

import clojure.lang.IPersistentSet; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> ClojureSet<T> create(IPersistentSet ts) {
    return new ClojureSet<>(ts);
}
 
开发者ID:rschmitt,项目名称:collider,代码行数:5,代码来源:ClojureSet.java

示例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));
}
 
开发者ID:rschmitt,项目名称:collider,代码行数:7,代码来源:ClojureSet.java


注:本文中的clojure.lang.IPersistentSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。