在运行以下代码时,会报java.util.ConcurrentModificationException异常, public class Demo { public static void main(String[] args) { List list = new LinkedList(); list.add("1"); list.add("#"); list.add("2"); list.add("#"); list.add…
newFixedThreadPool 创建一个固定大小的线程池. shutdown():用于关闭启动线程,如果不调用该语句,jvm不会关闭. awaitTermination():用于等待子线程结束,再继续执行下面的代码.该例中我设置一直等着子线程结束. Java代码 收藏代码 public class Test { public static void main(String[] args) throws IOException, InterruptedException { Executor…
include my own version for your reference. We use this one to zip up photos to download so it works with various unzip programs. It preserves the directory structure and timestamps. public static void createZipFile(File srcDir, OutputStream out, bool…