-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathManage.java
More file actions
34 lines (26 loc) · 944 Bytes
/
Manage.java
File metadata and controls
34 lines (26 loc) · 944 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
33
34
package Excercise_Dat4;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Manage {
private ArrayList<Information> information;
public Manage(){
this.information = new ArrayList<>();
}
public void addStaff(Information staffAdd){
this.information.add(staffAdd);
}
public List<Information> searchInformation(int id){
return this.information.stream().filter(ob->ob.getStaffId()==id).collect(Collectors.toList());
}
public void showList(){
this.information.forEach(ob-> System.out.println(ob.toString()));
}
public void update(Information information){
List<Information> info = this.searchInformation(information.getStaffId());
System.out.println(info.size());
info.get(0).setName(information.getName());
info.get(0).setGender(information.getGender());
}
}