package resources; import java.util.*; public class Available { private Shortage shortage; private Deriver deriver; private Map.Entry<String, Integer> value; public void updateArrival(Map.Entry<String, Integer> arrival, Map<String, Integer> stock) { Map<String, Integer> shortage = this.shortage.getValue(); int temp_get3; if (stock.get(arrival.getKey()) != null) { temp_get3 = stock.get(arrival.getKey()); } else { temp_get3 = 0; } value = new AbstractMap.SimpleEntry<>(arrival.getKey(), (arrival.getValue()+temp_get3)); this.shortage.updateAvailable(value); this.deriver.updateAvailable(value, shortage); } public Available(Shortage shortage, Deriver deriver) { this.shortage = shortage; this.deriver = deriver; } public Map.Entry<String, Integer> getValue() { return new AbstractMap.SimpleEntry<>(value); } }