HashMap源码分析 – 常见属性

static final int DEFAULT_INITIAL_CAPACITY = 1 << 4; // aka 16

/**
 * The maximum capacity, used if a higher value is implicitly specified
 * by either of the constructors with arguments.
 * MUST be a power of two <= 1<<30.
 */
static final int MAXIMUM_CAPACITY = 1 << 30;

/**
 * The load factor used when none specified in constructor.
 */
static final float DEFAULT_LOAD_FACTOR = 0.75f;

transient  HashMap.Node<K,V>[] table;

  /**
   * The number of key-value mappings contained in this map.
   */
  transient int size;

ransient int size;
DEFAULT_INITIAL_CAPACITY   默认的初始容量
DEFAULT_LOAD_FACTOR        默认的加载因子
扩容阈值 == 数组容量  *  加载因子
图片[1]-HashMap源码分析 – 常见属性-不念博客
© 版权声明
THE END
喜欢就支持一下吧
点赞130赞赏 分享
评论 抢沙发
头像
欢迎光临不念博客,留下您的想法和建议,祝您有愉快的一天~
提交
头像

昵称

取消
昵称

    暂无评论内容