List及数组中 contains的用法
String flag;
1.判断list中是否包含某个字符串 List<String> menuTreeTypes = proMenuService.getMenuTreeTypes(emp.getEmpId()); boolean contains = menuTreeTypes.contains(flag); 2.判断数组中是否包含某个字符串 String[] empTypes = empType.split(","); boolean contains = Arrays.asList(empTypes).contains(flag);
posted on 2021-07-26 16:26 ALWAYS☆REMIND 阅读(975) 评论(0) 编辑 收藏 举报