You are viewing a single comment's thread. Return to all comments →
Java 8:
static HashMap<Integer,Integer> map(List<List<Integer>> list){ HashMap<Integer, Integer> hashMap = new HashMap<>(); for(int i = 0 ; i < list.size(); i++){ hashMap.put(i+1 , list.get(i).get(0)+list.get(i).get(1)); } return hashMap; } static List<Entry<Integer, Integer>> orderHashMap(List<List<Integer>> list){ List<Entry<Integer, Integer>> listMap = new ArrayList<>(map(list).entrySet()); listMap.sort(Entry.comparingByValue()); return listMap; } public static List<Integer> jimOrders(List<List<Integer>> orders) { List<Integer> listTimes = new ArrayList<>(); orderHashMap(orders).forEach(element->{listTimes.add(element.getKey());}); return listTimes; }
Seems like cookies are disabled on this browser, please enable them to open this website
Jim and the Orders
You are viewing a single comment's thread. Return to all comments →
Java 8: