
jdk源码阅读
波波仔86
生活与技术并发!
展开
-
ArrayList addAll和LinkedList addAll对比
ArrayList和LinkedList从字面意义上看,前者是连续的地址存储空间,后者是链式的地址存储空间。1、ArrayList addAll() /** * Appends all of the elements in the specified collection to the end of * this list, in the order that they are...原创 2018-04-27 22:20:56 · 2521 阅读 · 0 评论 -
ArrayList 调用clear()后内存地址空间释放问题
之前想清空集合的元素,直接调用api clear()函数,突然想如果clear后只是把元素删除了,而没有释放内存地址空间,因为ArrayList是动态的分配内存,以后越来越多,会不会导致内存溢出。查看clear()函数源码: /** * Removes all of the elements from this list. The list will * be empty a...原创 2018-04-28 10:32:18 · 7620 阅读 · 0 评论