public Object put(Object key,Object value){
  Object oldValue=null;
synchronized (map) {
    oldValue=map.put(key,value);
    if (oldValue != null) {
      removeElement(key);
    }
    addElement(key);
  }
  return oldValue;
}

public Object put ( Object key , Object value ) { Object oldValue = null ; synchronized ( map ) { oldValue = map . put ( key , value ) ; if ( oldValue != null ) { removeElement ( key ) ; } addElement ( key ) ; } return oldValue ; }
puts the key and element to the map .
