P E N C I L
Login
Using stream

Issue

Some for loop code is not converted to stream style.

Actually, this is very opinionated . The stream-style code can be not very readable in comparison to for loop.

They just look more cool.

Example

Before refactor:

for (EntityOwner entityOwner : regOWInfos.keySet()) {
  if (entityOwner != EntityOwner.BUSINESS) {
    regOs.add(regOWInfos.get(entityOwner));
  }
}

After refactor

List<EadsResult> regOs = regOWInfos.keySet().stream()
.filter(key -> key != EntityOwner.BUSINESS)
.map(regOWInfos::get)
.collect(Collectors.toList());