Created
August 1, 2018 00:42
-
-
Save ariesmcrae/7d124cf5930b7244e8af8b314c25f4b9 to your computer and use it in GitHub Desktop.
Get minimum using java lambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Pick the cheapest plan | |
final AdjustmentPlan plan = plans.stream() | |
.min(Comparator.comparing(AdjustmentPlan::getMultiplier)) | |
.orElse(null); | |
final Double multiplier = plan != null ? plan.getMultiplier() : 1.0; | |
List<String> exceptions = new ArrayList<>(); | |
if (plan != null && PlanType.EXCEPTION.equals(plan.getPlanType())) { | |
exceptions.add(plan.getName()); | |
} | |
final Double finalRate = dpsResponse.getPrice() * multiplier; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment