java - 请问Map map = new HashMap;与Map map = Maps.Hashmap;创建的map对象有什么区别?
天蓬老师
天蓬老师 2017-04-18 10:45:14
0
2
814
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
巴扎黑

Are you talking about com.google.common.collect.Maps.newHashMap()?

大家讲道理

There is no difference, you will know after looking at the source code:

/**
   * Creates a <i>mutable</i>, empty {@code HashMap} instance.
   *
   * <p><b>Note:</b> if mutability is not required, use {@link
   * ImmutableMap#of()} instead.
   *
   * <p><b>Note:</b> if {@code K} is an {@code enum} type, use {@link
   * #newEnumMap} instead.
   *
   * @return a new, empty {@code HashMap}
   */
  public static <K, V> HashMap<K, V> newHashMap() {
    return new HashMap<K, V>();
  }
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template