當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。