com.carrotsearch.hppc.LongHashSet.ensureCapacity()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(79)

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

LongHashSet.ensureCapacity介绍

[英]Ensure this container can hold at least the given number of elements without resizing its buffers.
[中]确保此容器至少可以容纳给定数量的元素,而无需调整其缓冲区的大小。

代码示例

代码示例来源:origin: carrotsearch/hppc

/**
 * {@inheritDoc}
 */
@Override
public void release() {
 assigned = 0;
 hasEmptyKey = false;
 keys = null;
 ensureCapacity(Containers.DEFAULT_EXPECTED_ELEMENTS);
}

代码示例来源:origin: carrotsearch/hppc

/**
 * New instance with the provided defaults.
 * 
 * @param expectedElements
 *          The expected number of elements guaranteed not to cause a rehash (inclusive).
 * @param loadFactor
 *          The load factor for internal buffers. Insane load factors (zero, full capacity)
 *          are rejected by {@link #verifyLoadFactor(double)}.
 * @param orderMixer
 *          Hash key order mixing strategy. See {@link HashOrderMixing} for predefined
 *          implementations. Use constant mixers only if you understand the potential
 *          consequences.
 */
public LongHashSet(int expectedElements, double loadFactor, HashOrderMixingStrategy orderMixer) {
 this.orderMixer = orderMixer;
 this.loadFactor = verifyLoadFactor(loadFactor);
 ensureCapacity(expectedElements);
}

代码示例来源:origin: carrotsearch/hppc

/**
 * Adds all elements from the given list (vararg) to this set. 
 * 
 * @return Returns the number of elements actually added as a result of this
 *         call (not previously present in the set).
 */
/*  */
public final int addAll(long... elements) {
 ensureCapacity(elements.length);
 int count = 0;
 for (long e : elements) {
  if (add(e)) {
   count++;
  }
 }
 return count;
}

代码示例来源:origin: carrotsearch/hppc

/**
 * Adds all elements from the given {@link LongContainer} to this set.
 * 
 * @return Returns the number of elements actually added as a result of this
 *         call (not previously present in the set).
 */
public int addAll(LongContainer container) {
 ensureCapacity(container.size());
 return addAll((Iterable<? extends LongCursor>) container);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * {@inheritDoc}
 */
@Override
public void release() {
 assigned = 0;
 hasEmptyKey = false;
 keys = null;
 ensureCapacity(Containers.DEFAULT_EXPECTED_ELEMENTS);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * New instance with the provided defaults.
 * 
 * @param expectedElements
 *          The expected number of elements guaranteed not to cause a rehash (inclusive).
 * @param loadFactor
 *          The load factor for internal buffers. Insane load factors (zero, full capacity)
 *          are rejected by {@link #verifyLoadFactor(double)}.
 * @param orderMixer
 *          Hash key order mixing strategy. See {@link HashOrderMixing} for predefined
 *          implementations. Use constant mixers only if you understand the potential
 *          consequences.
 */
public LongHashSet(int expectedElements, double loadFactor, HashOrderMixingStrategy orderMixer) {
 this.orderMixer = orderMixer;
 this.loadFactor = verifyLoadFactor(loadFactor);
 ensureCapacity(expectedElements);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Adds all elements from the given list (vararg) to this set. 
 * 
 * @return Returns the number of elements actually added as a result of this
 *         call (not previously present in the set).
 */
/*  */
public final int addAll(long... elements) {
 ensureCapacity(elements.length);
 int count = 0;
 for (long e : elements) {
  if (add(e)) {
   count++;
  }
 }
 return count;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Adds all elements from the given {@link LongContainer} to this set.
 * 
 * @return Returns the number of elements actually added as a result of this
 *         call (not previously present in the set).
 */
public int addAll(LongContainer container) {
 ensureCapacity(container.size());
 return addAll((Iterable<? extends LongCursor>) container);
}

相关文章