Best practice Spring Batch raise a Return an empty collection instead of null

java

(Philippart S) #1

versions used : SonarQube : 5.6.1, Java Language

The above code raise a Return an empty collection instead of null. but it’s a best practice from Spring team : https://docs.spring.io/spring-batch/4.0.x/api/org/springframework/batch/item/ItemProcessor.html

@Override
    public List<EnrichedDSNLine> process(List<DSNLine> dsnLines) {
        if (dsnLines.isEmpty()) {
            log.warn("process launched but no input lines...'");
            return null;
      }
   }