public V putIfAbsent ( K k , V v ) { synchronized ( map ) { if ( ! containsKey ( k ) ) { list . addFirst ( k ) ; return map . put ( k , v ) ; } else { list . remove ( k ) ; } list . addFirst ( k ) ; return null ; } }
Puts a key to top of the map if absent if the key is present in stack it is removed