-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathShipmentServiceImpl.java
More file actions
39 lines (33 loc) · 1.08 KB
/
ShipmentServiceImpl.java
File metadata and controls
39 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.edureka.shipping;
import java.util.HashMap;
import java.util.Map;
public class ShipmentServiceImpl implements IShipment {
private Map<Integer, Shipment> shipments = new HashMap<>();
@Override
public boolean addShipment() {
Shipment shipment = new Shipment();
shipment.setResourceId(101);
shipment.setDeliveryText("Shipment Added");
shipments.put(shipment.getResourceId(), shipment);
System.out.println("Shipment added successfully: " + shipment.getResourceId());
return true;
}
@Override
public boolean deleteShipment() {
if (shipments.containsKey(101)) {
shipments.remove(101);
System.out.println("Shipment deleted successfully: 101");
return true;
}
return false;
}
@Override
public boolean getShipment() {
if (shipments.containsKey(101)) {
Shipment shipment = shipments.get(101);
System.out.println("Shipment found: " + shipment.getDeliveryText());
return true;
}
return false;
}
}