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

List.removeAll not working

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      List.removeAll not working

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      GroupAnocBomDTO(components={EOC=null, Cover Wrap=UHCA21PP4733440, ANOC=UHEX18HM4179402_001}, planYear=2022, sFLYStatus=COMPLETE, status=COMPLETE, kitType=Kit, contract=null, pbp=null, language=null, planName=null, groupName=Test Group, groupNumber=13706ANOC11114, segmentID=999, ome=null, maCw=null, anocSlipSheet=null, maAc=null, maEf=null, maPf=null, maDd=null, noticeComponent=null, rxSupplementalCertificate=null, onlineInsert=null, estLiveDate=null, bookWeight=null, wave1BookWeight=null, wave2BookWeight=null, pageCount=null, compPrice=null, stateCode=null, state=NV, facility=null, wave1Facility=null, wave2Facility=null, pdpPlanCode=null, pdpRegion=null, description=null, product=PDP, productName=null, rxType=null, upsmiCode=null, vendor=null, wave1Vendor=null, wave2Vendor=null, glCode=null, sourceSystem=PDP, thickness=null, wave1Thickness=null, wave2Thickness=null, mailingMethod=null, docRev=null, isLetter=null, portalAuditRequired=Yes, mapsProductionDate=09/01/2020, anocInHandDate=2021-03-31, cmImEmail=aaaaa@gmail.com, gpsId=123, gpsBranch=456, tfn=800-123-4567, url=http://www.test.com, hoursofOperation=9am-5pm, returnAddress1=123 main street, returnAddress2=null, city=Tempe, zipCode=85282, logoImageID=null, endDate=null, corporateID=null, label=null, subLabelTest=null, membershipEstimate=null, addressSheet=null, kitComponents=null)


      GroupAnocBomDTO dtoData = ...// create an object as per above data.
      List<GroupAnocBomDTO> dtos = new LinkedList<>();
      dtos.add(dtoData);


      Map<GroupAnocBomDTO, String> invalidBoms = new LinkedHashMap<>();
      invalidBoms .put(dtoData, "Invalid record found");

      if (!invalidBoms.isEmpty()) {
               boolean isRemoved = dtos.removeAll(invalidBoms.keySet());
      }


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      it should remove dto as both are same instance
      ACTUAL -
      its not removing the data element.

      While debugging found this method has issue:
      final Node<K,V> getNode(int hash, Object key)

      this condition "(first = tab[(n - 1) & hash]) != null" is not true so not removing element.

            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: