Without going into details, there are two instances of the method:
public static Map<CustomerServiceType, Double> calculateLossPerService(ServiceNodeAgent<?, ?, ?> scope) { Map<CustomerServiceType, Double> resultEnumKeys = Maps.newHashMap(); Map<CustomerServiceType, Long> serviceTypesToDroppedPackets = scope.getDroppedPacketsByServiceType().reduceRows(); Map<CustomerServiceType, Long> serviceTypesToReceivedPackets = scope.getReceivedPacketsByServiceType().reduceRows(); for (Map.Entry<CustomerServiceType, Long> customerServiceTypeDoubleEntry : serviceTypesToReceivedPackets.entrySet()) { Long droppedPackets = serviceTypesToDroppedPackets.get(customerServiceTypeDoubleEntry.getKey()); Long receivedPackets = Math.max(customerServiceTypeDoubleEntry.getValue(), 1); double result = droppedPackets / (double) receivedPackets; resultEnumKeys.put(customerServiceTypeDoubleEntry.getKey(), CommonUtils.clip(0.0, result, 1.0)); } return resultEnumKeys; } // ------------------------------------------------ -----------
public static Map<CustomerServiceType, Double> calculateLossPerService(ServiceNodeAgent scope) { Map<CustomerServiceType, Double> resultEnumKeys = Maps.newHashMap(); Map serviceTypesToDroppedPackets = scope.getDroppedPacketsByServiceType().reduceRows(); Map serviceTypesToReceivedPackets = scope.getReceivedPacketsByServiceType().reduceRows(); for (Object customerServiceTypeDoubleEntry : serviceTypesToReceivedPackets.entrySet()) { Map.Entry<CustomerServiceType, Long> customerServiceTypeDoubleEntry1 = (Map.Entry<CustomerServiceType, Long>) customerServiceTypeDoubleEntry;//<---тут Long droppedPackets = (Long) serviceTypesToDroppedPackets.get(customerServiceTypeDoubleEntry1.getKey()); Long receivedPackets = Math.max(customerServiceTypeDoubleEntry1.getValue(), 1); double result = droppedPackets / (double) receivedPackets; resultEnumKeys.put(customerServiceTypeDoubleEntry1.getKey(), CommonUtils.clip(0.0, result, 1.0)); } return resultEnumKeys; } In the second one, the compiler cursed that Unchecked cast in the string // <--- here After corrections, it acquired the form of 1 fragment. The question is why now the compiler stopped swearing?