Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8246245

typo in Map.replace api documentation

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      Hi, there is a typo in the documentation, interface Map, method replace:
      in the specification of the default method value is called instead of oldValue
      This is the text readable from the api online on docs.oracle.com:

      default boolean replace​(K key, V oldValue,V newValue)
      Replaces the entry for the specified key only if currently mapped to the specified value.
      Implementation Requirements:
          The default implementation is equivalent to, for this map:
             if (map.containsKey(key) && Objects.equals(map.get(key), OLDVALUE NOT VALUE )) {
               map.put(key, newValue);
               return true;
           } else
               return false;
           

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      just look at the documentation of interface map on docs.oracle.com, java version 14 (and 9 for what i saw)


      FREQUENCY : always


            smarks Stuart Marks
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: