java for循环删除使用迭代器

      Iterator iterator=hongBaoJuntanData.iterator();
            while (iterator.hasNext()){
                ProductJunTanData item=(ProductJunTanData)iterator.next();
                //判断该商品的活动Id是否包含再红包的指定活动列表中
                if (StringUtils.isNotEmpty(promoIds)&&!(',' + promoIds + ',').contains("," + item.getPromotionId() + ",") && !(isCommon && item.getPromotionId() == 0)) {
                    iterator.remove();
                }
                //判断该商品Id是否包含再红包的品类列表中
                if (StringUtils.isNotEmpty(productIds)&&!(',' + productIds + ',').contains("," + item.getId() + ",")) {
                    iterator.remove();
                }
                //判断该商品Id是否包含再红包的品类列表中
                if (StringUtils.isNotEmpty(brandProductIds)&&!(',' + brandProductIds + ',').contains("," + item.getId() + ",")) {
                    iterator.remove();
                }
            }

 

posted @ 2020-03-11 22:09  &小程序&  阅读(539)  评论(0编辑  收藏  举报