List<String> stateCodes = stateList.stream()
.map(state-> physician.getStateDetails().getStateCode())
.collect(Collectors.toList());
当我打印stateCodes时,它会返回:
[ , , 197, 148, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ]
我这里只需要 [197,148]。