[Solved] Is there a more efficient way to write multiple if else? [duplicate]
You may find this approach verbose and overengineered. Yes, it’s. Though, I like the way the grading system is defined. class Test { public static void main(String[] args) { Map<String, Predicate<Integer>> gradingSystem = new HashMap<>(); gradingSystem.put(“A”, mark -> mark >= 90 && mark <= 100); gradingSystem.put(“B”, mark -> mark >= 80 && mark < 90); … Read more