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

ConcurrentHashMap.remove(x,null) might remove x

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • core-libs
    • b51
    • generic
    • generic
    • Verified

      This program:

      import java.util.*;
      import java.util.concurrent.*;
      import static java.lang.System.out;

      public class tt {
          public static void main(String[] args) throws Exception {
      ConcurrentMap<Long,Long>m = new ConcurrentHashMap<Long,Long>();
      out.println(m.put(1L,2L));
      out.println(m.remove(1L,null));
      out.println(m.remove(1L,null));

          }
      }


      should print
      null
      false
      false

      Instead, it prints
      null
      true
      false

      ###@###.### 2005-05-18 18:05:40 GMT

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: