Properties.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
@Override
void readHashtable(ObjectInputStream s) throws IOException,
        ClassNotFoundException {
    // Read in the threshold and loadfactor
    s.defaultReadObject();

    // Read the original length of the array and number of elements
    int origlength = s.readInt();
    int elements = s.readInt();

    // Validate # of elements
    if (elements < 0) {
        throw new StreamCorruptedException("Illegal # of Elements: " + elements);
    }

    // create CHM of appropriate capacity
    map = new ConcurrentHashMap<>(elements);

    // Read all the key/value objects
    for (; elements > 0; elements--) {
        Object key = s.readObject();
        Object value = s.readObject();
        map.put(key, value);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号