//package base;
//
//import com.yanzuoguang.util.thread.ThreadHelper;
//import org.junit.Test;
//import sun.misc.GC;
//
//import java.util.Map;
//import java.util.WeakHashMap;
//
//public class WeakHashMapTest {
//
//    public static class MyKey{
//
//    }
//
//    @Test
//    public void test() throws InterruptedException {
//        Map<MyKey,Integer> map = new WeakHashMap<>();
//        test1(map);
//        System.out.println(map.size());
//        Thread thread = new Thread(new Runnable() {
//            @Override
//            public void run() {
//                while(true){
//                    System.gc();
//                    System.out.println(map.size());
//                    ThreadHelper.sleep(100);
//                }
//            }
//        });
//        thread.start();
//        thread.join();
//    }
//
//    private void test1(Map<MyKey,Integer> map ){
//        map.put(new MyKey(),1);
//    }
//}