public static <K,V> Map<K,List<V>> groupByKey(List<Pair<K,V>> listInput) {
        Map<K,List<V>> ret = new HashMap<>();
        for(Pair<K,V> pair : listInput) {
            List<V> currList = ret.get(pair.getFirst());
            if(currList == null) {
                currList = new ArrayList<>();
                ret.put(pair.getFirst(),currList);
            }

            currList.add(pair.getSecond());
        }

        return ret;
    }
@Test
    public void testGroupBy() {
        List<Pair<Integer,Integer>> list = new ArrayList<>();
        for(int i = 0; i < 10; i++) {
            for(int j = 0; j < 5; j++) {
                list.add(Pair.of(i, j));
            }
        }

        Map<Integer, List<Integer>> integerIterableMap = FunctionalUtils.groupByKey(list);
        assertEquals(10,integerIterableMap.keySet().size());
        assertEquals(5,integerIterableMap.get(0).size());
    }