java.util.concurrent.ConcurrentSkipListSet.comparator()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中java.util.concurrent.ConcurrentSkipListSet.comparator()方法的一些代码示例,展示了ConcurrentSkipListSet.comparator()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListSet.comparator()方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListSet
类名称:ConcurrentSkipListSet
方法名:comparator

ConcurrentSkipListSet.comparator介绍

暂无

代码示例

代码示例来源:origin: apache/ignite

/**
 * Attempts to create a new set of the same type as {@code set} has. Otherwise returns new {@code HashSet}
 * instance.
 *
 * @param set Original set.
 * @return New set.
 */
public static <V> Set<V> newSet(Set<V> set) {
  if (set instanceof LinkedHashSet)
    return U.newLinkedHashSet(set.size());
  else if (set instanceof TreeSet)
    return new TreeSet<>(((TreeSet<Object>)set).comparator());
  else if (set instanceof ConcurrentSkipListSet)
    return new ConcurrentSkipListSet<>(((ConcurrentSkipListSet<Object>)set).comparator());
  return U.newHashSet(set.size());
}

代码示例来源:origin: apache/ignite

/**
 * Attempts to create a new collection of the same known type. Will return null if collection type is unknown.
 *
 * @param col Collection.
 * @return New empty collection.
 */
public static <V> Collection<V> newKnownCollection(Object col) {
  Class<?> cls = col == null ? null : col.getClass();
  if (cls == HashSet.class)
    return U.newHashSet(((Collection)col).size());
  else if (cls == LinkedHashSet.class)
    return U.newLinkedHashSet(((Collection)col).size());
  else if (!wrapTrees() && cls == TreeSet.class)
    return new TreeSet<>(((TreeSet<Object>)col).comparator());
  else if (cls == ConcurrentSkipListSet.class)
    return new ConcurrentSkipListSet<>(((ConcurrentSkipListSet<Object>)col).comparator());
  else if (cls == ArrayList.class)
    return new ArrayList<>(((Collection)col).size());
  else if (cls == LinkedList.class)
    return new LinkedList<>();
  else if (cls == SINGLETON_LIST_CLS)
    return new MutableSingletonList<>();
  return null;
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.utils/org.eclipse.scada.utils

@Override
public Comparator<? super E> comparator ()
{
  return this.internalSet.comparator ();
}

代码示例来源:origin: org.apache.ignite/ignite-core

/**
 * Attempts to create a new set of the same type as {@code set} has. Otherwise returns new {@code HashSet}
 * instance.
 *
 * @param set Original set.
 * @return New set.
 */
public static <V> Set<V> newSet(Set<V> set) {
  if (set instanceof LinkedHashSet)
    return U.newLinkedHashSet(set.size());
  else if (set instanceof TreeSet)
    return new TreeSet<>(((TreeSet<Object>)set).comparator());
  else if (set instanceof ConcurrentSkipListSet)
    return new ConcurrentSkipListSet<>(((ConcurrentSkipListSet<Object>)set).comparator());
  return U.newHashSet(set.size());
}

代码示例来源:origin: org.apache.ignite/ignite-core

/**
 * Attempts to create a new collection of the same known type. Will return null if collection type is unknown.
 *
 * @param col Collection.
 * @return New empty collection.
 */
@SuppressWarnings("unchecked")
public static <V> Collection<V> newKnownCollection(Object col) {
  Class<?> cls = col == null ? null : col.getClass();
  if (cls == HashSet.class)
    return U.newHashSet(((Collection)col).size());
  else if (cls == LinkedHashSet.class)
    return U.newLinkedHashSet(((Collection)col).size());
  else if (!wrapTrees() && cls == TreeSet.class)
    return new TreeSet<>(((TreeSet<Object>)col).comparator());
  else if (cls == ConcurrentSkipListSet.class)
    return new ConcurrentSkipListSet<>(((ConcurrentSkipListSet<Object>)col).comparator());
  else if (cls == ArrayList.class)
    return new ArrayList<>(((Collection)col).size());
  else if (cls == LinkedList.class)
    return new LinkedList<>();
  else if (cls == SINGLETON_LIST_CLS)
    return new MutableSingletonList<>();
  return null;
}

相关文章

微信公众号

最新文章

更多