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

HashSet containsAll method returning true for empty set values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 8u202
    • core-libs

      A DESCRIPTION OF THE PROBLEM :
      HashSet containsAll method returning true for empty set values
      Example:

      Set<Long> first=new HashSet<>();
              first.add(2L);

              Set<Long> second=new HashSet<>();
              first.containsAll(second) -->true;
      comparing an empty list with a list which has values returning true,which should return false.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      false

      ---------- BEGIN SOURCE ----------
      import java.util.HashSet;
      import java.util.Set;

      public class Test2 {

          public static void main(String[] args){
              Set<Long> first=new HashSet<>();
              first.add(2L);

              Set<Long> second=new HashSet<>();
              first.containsAll(second);
              System.out.println(first.containsAll(second));

          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: