package waitnotifytest; import java.util.Collections; import java.util.List; import com.google.common.collect.Lists; /** * Test */ public class Test { private static final Class<Test> lockObj = Test.class; private final List<String> list = Col…
一.使用while方式来实现线程之间的通信 package com.ietree.multithread.sync; import java.util.ArrayList; import java.util.List; public class MyList { private volatile static List list = new ArrayList(); public void add() { list.add("apple"); } public int size() {…