Java tutorial
//package com.java2s; import java.lang.ref.WeakReference; import java.util.LinkedList; import java.util.List; public class Main { private static List<WeakReference<Object>> list = new LinkedList<>(); public static void observeObject(Object obj) { list.add(new WeakReference<Object>(obj)); } }