Skip to content

Commit

Permalink
apply some code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentina Bojan committed May 5, 2020
1 parent 0aecf53 commit 4ca4dce
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,9 @@ public ModelConverterRegistrar(List<ModelConverter> modelConverters) {
for (ModelConverter modelConverter : modelConverters) {
Optional<ModelConverter> registeredConverterOptional = getRegisteredConverterSameAs(modelConverter);

if (!registeredConverterOptional.isPresent()) {
ModelConverters.getInstance().addConverter(modelConverter);
} else {
registeredConverterOptional.ifPresent(alreadyRegisteredModelConverter -> {
ModelConverters.getInstance().removeConverter(alreadyRegisteredModelConverter);
ModelConverters.getInstance().addConverter(modelConverter);
});
}
ModelConverters modelConvertersInstance = ModelConverters.getInstance();
registeredConverterOptional.ifPresent(modelConvertersInstance::removeConverter);
modelConvertersInstance.addConverter(modelConverter);
}
}

Expand Down

0 comments on commit 4ca4dce

Please sign in to comment.