The code appears to be correct in terms of checking whether the collection contains 2 and 3 correctly. \n\nThe code iterates through the projectRouteMapDataList and checks the projectTypeId of each object. If the projectTypeId is 2, it sets has2 to true. If the projectTypeId is 3, it sets has3 to true.\n\nAfter the loop, it checks the values of has2 and has3 to determine the appropriate value to set for sendMapDto.getProject(). If has2 is true and has3 is false, it sets sendMapDto.getProject() to 1. If has2 is false and has3 is true, it sets sendMapDto.getProject() to 2. If both has2 and has3 are true, it sets sendMapDto.getProject() to 3.\n\nAdditionally, if has3 is true, it sets sendMapDto.getProjectRouteMapDataList() to the original projectRouteMapDataList. If both has2 and has3 are true, it filters the projectRouteMapDataList to only include objects with projectTypeId 3, and sets the filtered list to sendMapDto.getProjectRouteMapDataList(). \n\nOverall, the code seems to correctly determine whether the collection contains 2 and 3 and sets the appropriate values in the sendMapDto object.

Java Code for Checking Collection for Values 2 and 3

原文地址: https://www.cveoy.top/t/topic/mzoW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录