java.util.TreeMap.putInternal()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(143)

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

TreeMap.putInternal介绍

暂无

代码示例

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

/**
 * Create a natural order tree map populated with the key/value pairs of
 * {@code copyFrom}. This map's keys must be mutually comparable and
 * non-null.
 *
 * <p>Even if {@code copyFrom} is a {@code SortedMap}, the constructed map
 * <strong>will not</strong> use {@code copyFrom}'s ordering. This
 * constructor always creates a naturally-ordered map. Because the {@code
 * TreeMap} constructor overloads are ambiguous, prefer to construct a map
 * and populate it in two steps: <pre>   {@code
 *   TreeMap<String, Integer> customOrderedMap
 *       = new TreeMap<String, Integer>(copyFrom.comparator());
 *   customOrderedMap.putAll(copyFrom);
 * }</pre>
 */
public TreeMap(Map<? extends K, ? extends V> copyFrom) {
  this();
  for (Map.Entry<? extends K, ? extends V> entry : copyFrom.entrySet()) {
    putInternal(entry.getKey(), entry.getValue());
  }
}

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

/**
 * Create a tree map with the ordering and key/value pairs of {@code
 * copyFrom}. This map's keys may only be null if the {@code copyFrom}'s
 * ordering permits.
 *
 * <p>The constructed map <strong>will always use</strong> {@code
 * copyFrom}'s ordering. Because the {@code TreeMap} constructor overloads
 * are ambiguous, prefer to construct a map and populate it in two steps:
 * <pre>   {@code
 *   TreeMap<String, Integer> customOrderedMap
 *       = new TreeMap<String, Integer>(copyFrom.comparator());
 *   customOrderedMap.putAll(copyFrom);
 * }</pre>
 */
@SuppressWarnings("unchecked") // if copyFrom's keys are comparable this map's keys must be also
public TreeMap(SortedMap<K, ? extends V> copyFrom) {
  Comparator<? super K> sourceComparator = copyFrom.comparator();
  if (sourceComparator != null) {
    this.comparator = sourceComparator;
  } else {
    this.comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  for (Map.Entry<K, ? extends V> entry : copyFrom.entrySet()) {
    putInternal(entry.getKey(), entry.getValue());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

@Override public V put(K key, V value) {
  return putInternal(key, value);
}

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

/**
 * Create a natural order tree map populated with the key/value pairs of
 * {@code copyFrom}. This map's keys must be mutually comparable and
 * non-null.
 *
 * <p>Even if {@code copyFrom} is a {@code SortedMap}, the constructed map
 * <strong>will not</strong> use {@code copyFrom}'s ordering. This
 * constructor always creates a naturally-ordered map. Because the {@code
 * TreeMap} constructor overloads are ambiguous, prefer to construct a map
 * and populate it in two steps: <pre>   {@code
 *   TreeMap<String, Integer> customOrderedMap
 *       = new TreeMap<String, Integer>(copyFrom.comparator());
 *   customOrderedMap.putAll(copyFrom);
 * }</pre>
 */
public TreeMap(Map<? extends K, ? extends V> copyFrom) {
  this();
  for (Map.Entry<? extends K, ? extends V> entry : copyFrom.entrySet()) {
    putInternal(entry.getKey(), entry.getValue());
  }
}

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

/**
 * Create a natural order tree map populated with the key/value pairs of
 * {@code copyFrom}. This map's keys must be mutually comparable and
 * non-null.
 *
 * <p>Even if {@code copyFrom} is a {@code SortedMap}, the constructed map
 * <strong>will not</strong> use {@code copyFrom}'s ordering. This
 * constructor always creates a naturally-ordered map. Because the {@code
 * TreeMap} constructor overloads are ambiguous, prefer to construct a map
 * and populate it in two steps: <pre>   {@code
 *   TreeMap<String, Integer> customOrderedMap
 *       = new TreeMap<String, Integer>(copyFrom.comparator());
 *   customOrderedMap.putAll(copyFrom);
 * }</pre>
 */
public TreeMap(Map<? extends K, ? extends V> copyFrom) {
  this();
  for (Entry<? extends K, ? extends V> entry : copyFrom.entrySet()) {
    putInternal(entry.getKey(), entry.getValue());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

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

@SuppressWarnings("unchecked") // we have to trust that keys are Ks and values are Vs
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
  GetField fields = stream.readFields();
  comparator = (Comparator<? super K>) fields.get("comparator", null);
  if (comparator == null) {
    comparator = (Comparator<? super K>) NATURAL_ORDER;
  }
  int size = stream.readInt();
  for (int i = 0; i < size; i++) {
    putInternal((K) stream.readObject(), (V) stream.readObject());
  }
}

相关文章