This is my code , which is returning spaces along with some valid strings. But, my requirement is to invalidate space and collect only strings
List<String> stateCodes = stateList.stream()
.map(state-> physician.getStateDetails().getStateCode())
.collect(Collectors.toList());
When I print stateCodes, it returns
[ , , 197, 148, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ]
Here I require only [197,148]