问题1:
指定 ArrayList 的大小是否有意义?我知道我的 List 中将包含多少元素,事先指定大小是否好,或者甚至无关紧要。
List<String> list = new ArrayList<String>(1);
list.add("Hello");
List<String> newList = new ArrayList<String>();
newList.add("Hello");
问题2:
java.util.ConcurrentModificationException 当您在迭代同一集合时操作(添加、删除)集合时发生。Does that mean there is a thread which is modifying the ArrayList and another Thread iterating the same object.
问题3
谁能告诉我如何锁定列表?