// "Replace Stream API chain with loop" "true" import java.util.*; public class Main { private static Optional max(Map> dependencies, String fruits, Map weights) { return dependencies.get(fruits).stream().max((o1, o2) -> o1.compareTo(o2) < 0 ? -1 : o1.compareTo(o2) > 0 ? 1 : 0); } }