java.util.Hashtable.constructorPut()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(169)

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

Hashtable.constructorPut介绍

[英]This method is just like put, except that it doesn't do things that are inappropriate or unnecessary for constructors and pseudo-constructors (i.e., clone, readObject). In particular, this method does not check to ensure that capacity is sufficient, and does not increment modCount.
[中]此方法与put类似,只是它不做对构造函数和伪构造函数(即克隆、readObject)不合适或不必要的事情。特别是,此方法不会检查以确保容量足够,也不会增加modCount。

代码示例

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

/**
 * Inserts all of the elements of map into this Hashtable in a manner
 * suitable for use by constructors and pseudo-constructors (i.e., clone,
 * readObject).
 */
private void constructorPutAll(Map<? extends K, ? extends V> map) {
  if (table == EMPTY_TABLE) {
    doubleCapacity(); // Don't do unchecked puts to a shared table.
  }
  for (Entry<? extends K, ? extends V> e : map.entrySet()) {
    constructorPut(e.getKey(), e.getValue());
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

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

private void readObject(ObjectInputStream stream) throws IOException,
      ClassNotFoundException {
    stream.defaultReadObject();
    int capacity = stream.readInt();
    if (capacity < 0) {
      throw new InvalidObjectException("Capacity: " + capacity);
    }
    if (capacity < MINIMUM_CAPACITY) {
      capacity = MINIMUM_CAPACITY;
    } else if (capacity > MAXIMUM_CAPACITY) {
      capacity = MAXIMUM_CAPACITY;
    } else {
      capacity = Collections.roundUpToPowerOfTwo(capacity);
    }
    makeTable(capacity);

    int size = stream.readInt();
    if (size < 0) {
      throw new InvalidObjectException("Size: " + size);
    }

    for (int i = 0; i < size; i++) {
      @SuppressWarnings("unchecked") K key = (K) stream.readObject();
      @SuppressWarnings("unchecked") V val = (V) stream.readObject();
      constructorPut(key, val);
    }
  }
}

相关文章