Code example for ReferenceQueue

import java.lang.ref.Reference; 
import java.lang.ref.ReferenceQueue; 
import java.util.Iterator; 
import java.util.Map; 
import java.util.Set; 
public class CleanUpThread <K,V>  extends Thread{
	ReferenceQueue<V> refQueue = new ReferenceQueue<V>();
	Map<K, V> cache = null;
	public CleanUpThread(ReferenceQueue refQueue, Map softCache) {
		this.refQueue = refQueue;
	   	cache = softCache;
	public void run() { 
		// TODO Auto-generated method stub 
			while(true) { 
				try { 
					synchronized(cache) {
Connect your IDE to all the code out there  Get Codota for Java