public Collection<V> filter(Collection<K> request){
  Collection<V> rv=new ArrayList<V>();
  for (Iterator<K> iter=request.iterator(); iter.hasNext(); ) {
    K key=iter.next();
    V val=get(key);
    if (val != null) {
      rv.add(val);
      iter.remove();
    }
  }
  return rv;
}

public Collection < V > filter ( Collection < K > request ) { Collection < V > rv = new ArrayList < V > ( ) ; for ( Iterator < K > iter = request . iterator ( ) ; iter . hasNext ( ) ; ) { K key = iter . next ( ) ; V val = get ( key ) ; if ( val != null ) { rv . add ( val ) ; iter . remove ( ) ; } } return rv ; }
this convenience method filters a request by removing all items in the request which are in the cache and returning the corresponding values . synchronization note : this method is not synchronized on the cache . thus , if replacements are performed during a canonicalization , it is undefined which object is returned . similarly , this function is not synchronized on the request collection , so if synchronization is required , it must be performed externally .
