java.util.WeakHashMap.newEntryArray()方法的使用及代码示例

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

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

WeakHashMap.newEntryArray介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: robovm/robovm

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: robovm/robovm

/**
 * Constructs a new {@code WeakHashMap} instance with the specified capacity
 * and load factor.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @param loadFactor
 *            the initial load factor.
 * @throws IllegalArgumentException
 *             if the capacity is less than zero or the load factor is less
 *             or equal to zero.
 */
public WeakHashMap(int capacity, float loadFactor) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  if (loadFactor <= 0) {
    throw new IllegalArgumentException("loadFactor <= 0: " + loadFactor);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  this.loadFactor = (int) (loadFactor * 10000);
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: MobiVM/robovm

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: ibinti/bugvm

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: MobiVM/robovm

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: ibinti/bugvm

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Constructs a new {@code WeakHashMap} instance with the specified
 * capacity.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @throws IllegalArgumentException
 *                if the capacity is less than zero.
 */
public WeakHashMap(int capacity) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  loadFactor = 7500; // Default load factor of 0.75
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: com.bugvm/bugvm-rt

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: com.gluonhq/robovm-rt

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: com.jtransc/jtransc-rt

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: FlexoVM/flexovm

private void rehash() {
  int length = elementData.length * 2;
  if (length == 0) {
    length = 1;
  }
  Entry<K, V>[] newData = newEntryArray(length);
  for (int i = 0; i < elementData.length; i++) {
    Entry<K, V> entry = elementData[i];
    while (entry != null) {
      int index = entry.isNull ? 0 : (entry.hash & 0x7FFFFFFF)
          % length;
      Entry<K, V> next = entry.next;
      entry.next = newData[index];
      newData[index] = entry;
      entry = next;
    }
  }
  elementData = newData;
  computeMaxSize();
}

代码示例来源:origin: MobiVM/robovm

/**
 * Constructs a new {@code WeakHashMap} instance with the specified capacity
 * and load factor.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @param loadFactor
 *            the initial load factor.
 * @throws IllegalArgumentException
 *             if the capacity is less than zero or the load factor is less
 *             or equal to zero.
 */
public WeakHashMap(int capacity, float loadFactor) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  if (loadFactor <= 0) {
    throw new IllegalArgumentException("loadFactor <= 0: " + loadFactor);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  this.loadFactor = (int) (loadFactor * 10000);
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: ibinti/bugvm

/**
 * Constructs a new {@code WeakHashMap} instance with the specified capacity
 * and load factor.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @param loadFactor
 *            the initial load factor.
 * @throws IllegalArgumentException
 *             if the capacity is less than zero or the load factor is less
 *             or equal to zero.
 */
public WeakHashMap(int capacity, float loadFactor) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  if (loadFactor <= 0) {
    throw new IllegalArgumentException("loadFactor <= 0: " + loadFactor);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  this.loadFactor = (int) (loadFactor * 10000);
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Constructs a new {@code WeakHashMap} instance with the specified capacity
 * and load factor.
 *
 * @param capacity
 *            the initial capacity of this map.
 * @param loadFactor
 *            the initial load factor.
 * @throws IllegalArgumentException
 *             if the capacity is less than zero or the load factor is less
 *             or equal to zero.
 */
public WeakHashMap(int capacity, float loadFactor) {
  if (capacity < 0) {
    throw new IllegalArgumentException("capacity < 0: " + capacity);
  }
  if (loadFactor <= 0) {
    throw new IllegalArgumentException("loadFactor <= 0: " + loadFactor);
  }
  elementCount = 0;
  elementData = newEntryArray(capacity == 0 ? 1 : capacity);
  this.loadFactor = (int) (loadFactor * 10000);
  computeMaxSize();
  referenceQueue = new ReferenceQueue<K>();
}

相关文章