场景:
在实际业务场景中,通常会遇见在某个循环块中,通过自定义规则,如果前面数据已经做过相同的业务动作,则后面数据再有相同的规则就不需要再执行该动作。例如发送邮件
1、代码示例:
List accountBalanceList = Collections.synchronizedList(ListUtil.toList());AccountBalance accountBalanceOne = new AccountBalance();accountBalanceOne.setAccountNo("a1").setEmail("aa@qq.com").setRemark("备注One");accountBalanceList.add(accountBalanceOne);AccountBalance accountBalanceTwo = new AccountBalance();accountBalanceTwo.setAccountNo("a2").setEmail("bb@qq.com").setRemark("备注Two");accountBalanceList.add(accountBalanceTwo);AccountBalance accountBalanceThree = new AccountBalance();accountBalanceThree.setAccountNo("a2").setEmail("bb@qq.com").setRemark("备注Three");