ui/src/main/java/ucar/nc2/ui/image/PictureCache.java
public static synchronized void removeLeastPopular() {
		Tools.log("PictureCache.removeLeastPopular:");
		//reportCache();

		Enumeration e = removalQueue.elements();
		while ( ( e.hasMoreElements() ) 
		    &&  ( pictureCache.size() >= maxCache ) ) {
		     	String removeElement = (String) e.nextElement();
		     	Tools.log ("PictureCache.remove: " + removeElement );
			pictureCache.remove( removeElement );
			removalQueue.remove( removeElement );
		}
		
		e = pictureCache.keys();
		while ( ( pictureCache.size() >= maxCache )
		     && ( e.hasMoreElements() ) ) {
		     	String removeElement = (String) e.nextElement();
		     	Tools.log ("PictureCache.remove: " + removeElement );
			pictureCache.remove( removeElement );
		}
	}
public static synchronized void removeLeastPopular() {
		Tools.log("PictureCache.removeLeastPopular:");
		//reportCache();

		Enumeration e = removalQueue.elements();
		while ( ( e.hasMoreElements() ) 
		    &&  ( pictureCache.size() >= maxCache ) ) {
		     	String removeElement = (String) e.nextElement();
		     	Tools.log ("PictureCache.remove: " + removeElement );
			pictureCache.remove( removeElement );
			removalQueue.remove( removeElement );
		}
		
		e = pictureCache.keys();
		while ( ( pictureCache.size() >= maxCache )
		     && ( e.hasMoreElements() ) ) {
		     	String removeElement = (String) e.nextElement();
		     	Tools.log ("PictureCache.remove: " + removeElement );
			pictureCache.remove( removeElement );
		}
	}
this method removes the least popular picture(s) in the cache.
It first removes those pictures which have been suggested for
removal. And then it picks any it can find
As many pictures are removed as nescessary untill there are less pictures in the
cache than the Settings.maxCache specifies. (If maxCache is 0 then the
Enumeration finds no elements and we don't get an endless loop.