public V put ( K key , V value ) { V old = super . put ( key , value ) ; if ( size ( ) > bound ) { remove ( firstKey ( ) ) ; } return old ; }
Adds the key - value mapping to this map and if the total number of mappings exceeds the bounds removes either the currently lowest element or if reversed the currently highest element .