Java list根据另一个list排重
result = tableColumnMapper.getTableColumnSchemasWithPage(param); //region 过滤已存在TableColumnWithPageParam domain = new TableColumnWithPageParam();domain.setTableId(param.getTableId());List<TableColumnResult> existList = tableColumnMapper.getTableColumnListWithPage(domain);List<TableColumnSchemaResult> resList = result.stream().filter(new Predicate<TableColumnSchemaResult>() { @Override public boolean test(TableColumnSchemaResult u) { //如根据name过滤 for (TableColumnResult user : existList) { if (u.getColumnName().equals(user.getColumnName())) { return false; } } return true; }}).collect(Collectors.toList());//endregion
赞 (0)