I had this piece of code below:
 PriorityQueue<Map.Entry<Integer, Integer>> pq = new PriorityQueue<>(dscsortedMAP.size(), new Comparator<Map.Entry<Integer, Integer>>() {
        @Override
        public int compare(Map.Entry<Integer, Integer> arg0, Map.Entry<Integer, Integer> arg1) {
            return arg1.getValue().compareTo(arg0.getValue());
        }
    });
Than IntelliJ IDEA friendly suggested that I can replace the code above to a lambda expression like below:
    PriorityQueue<Map.Entry<Integer, Integer>> pq = new PriorityQueue<>(dscsortedMAP.size(), (arg0, arg1) -> {
        return arg1.getValue().compareTo(arg0.getValue());
    });
Well guess what happened, in my method the execution time of the 2. code executed 20 times slower?! First version took 7 miliseconds to sort the list, and after lambda expression it was 140 miliseconds?!
Am I missing something here? I didn't test if the execuation time proportionally increases as data grows. maybe thats just the initial one time cpu time?
 
    