package resources; import java.util.*; public class Request { private Shortage shortage; private Deriver deriver; private Stock stock; private Map.Entry<String, Integer> value; public Request(Shortage shortage, Deriver deriver, Stock stock) { this.shortage = shortage; this.deriver = deriver; this.stock = stock; } public void req(int num, String item) { this.value = new AbstractMap.SimpleEntry<>(item, num); Map<String, Integer> stock = this.stock.getValue(); this.shortage.updateRequest(value, stock); this.deriver.updateRequest(value, stock); } public Map.Entry<String, Integer> getValue() { return new AbstractMap.SimpleEntry<>(value); } }