Leetcode Two Sum problem solving using Java 8