Vector.removeAll() removes all occurences

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs

      ADDITIONAL SYSTEM INFORMATION :
      64 bit, windows 11, java 21 version

      A DESCRIPTION OF THE PROBLEM :
      import java.util.Vector;

      public class ArrayListAndVector {
      public static void main(String[] args) {
      Vector v1 = new Vector<>();

      v1.add("Sunil");
      v1.add("Praveen");
      v1.add(0, "Nithin");


      Vector v2 = new Vector();
      v2.add(45);
      v2.add("Nithin");
      v2.add(true);

      v1.addAll(v2);


      v1.removeAll(v2);
      System.out.println(v1);
      }
      }


      Expected output :
      [Nithin, Sunil, Praveen]

      Actual output :
      [Sunil, Praveen]


            Assignee:
            Unassigned
            Reporter:
            Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: