boolean () { boolean processed = mySoftKeyMap.processQueue(); while(true) { //noinspection unchecked ValueReference<K,V> ref = (ValueReference<K, V>)myQueue.poll(); if (ref == null) break; RefHashMap.Key<K> key = ref.key; mySoftKeyMap.removeKey(key); processed = true; } return processed; }