-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathOperatorRepository.java
More file actions
32 lines (24 loc) · 868 Bytes
/
OperatorRepository.java
File metadata and controls
32 lines (24 loc) · 868 Bytes
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
package ParkingLot.repositories;
import ParkingLot.models.Operator;
import ParkingLot.models.ParkingLot;
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
public class OperatorRepository {
public Map<Integer, Operator> operators = new TreeMap<>();
public OperatorRepository() {
Operator operator = new Operator("entrywaala","[email protected]");
operator.setId(1);
operators.put(operator.getId(), operator);
Operator operator2 = new Operator("exitwaala","[email protected]");
operator2.setId(2);
operators.put(operator2.getId(), operator2);
}
public Optional<Operator> getOperatorById(int operatorId)
{
if(operators.containsKey(operatorId)){
return Optional.of(operators.get(operatorId));
}
return Optional.empty();
}
}