@Override public int compare(TaskManagerSlot o1, TaskManagerSlot o2) { ResourceID rid1 = o1.getSlotId().getResourceID(); ResourceID rid2 = o2.getSlotId().getResourceID(); Tuple2<Map<SlotID, ResourceProfile>, ResourceProfile> t1 = allocatedSlotsResource.get(rid1); Tuple2<Map<SlotID, ResourceProfile>, ResourceProfile> t2 = allocatedSlotsResource.get(rid2); if (t1 != null && t2 != null) { return t2.f1.compareTo(t1.f1); } else if (t1 == null && t2 == null) { return 0; } else { return t1 == null ? -1 : 1; } } }; break;