File tree Expand file tree Collapse file tree
main/java/com/stackify/stream Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 <artifactId >log4j-core</artifactId >
1717 <version >${log4j2.version} </version >
1818 </dependency >
19+ <dependency >
20+ <groupId >org.hamcrest</groupId >
21+ <artifactId >hamcrest-core</artifactId >
22+ <version >${org.hamcrest.version} </version >
23+ <scope >test</scope >
24+ </dependency >
25+ <dependency >
26+ <groupId >org.hamcrest</groupId >
27+ <artifactId >hamcrest-library</artifactId >
28+ <version >${org.hamcrest.version} </version >
29+ <scope >test</scope >
30+ </dependency >
31+ <dependency >
32+ <groupId >org.hamcrest</groupId >
33+ <artifactId >hamcrest-all</artifactId >
34+ <version >${org.hamcrest.version} </version >
35+ <scope >test</scope >
36+ </dependency >
1937 </dependencies >
2038
2139 <build >
3250 </build >
3351 <properties >
3452 <log4j2 .version>2.8.2</log4j2 .version>
53+ <org .hamcrest.version>1.3</org .hamcrest.version>
3554 </properties >
3655</project >
Original file line number Diff line number Diff line change 1+ package com .stackify .stream ;
2+
3+ public class Employee {
4+ private Integer id ;
5+ private String name ;
6+ private Double salary ;
7+
8+ public Employee (Integer id , String name , Double salary ) {
9+ this .id = id ;
10+ this .name = name ;
11+ this .salary = salary ;
12+ }
13+
14+ public Integer getId () {
15+ return id ;
16+ }
17+
18+ public void setId (Integer id ) {
19+ this .id = id ;
20+ }
21+
22+ public String getName () {
23+ return name ;
24+ }
25+
26+ public void setName (String name ) {
27+ this .name = name ;
28+ }
29+
30+ public Double getSalary () {
31+ return salary ;
32+ }
33+
34+ public void setSalary (Double salary ) {
35+ this .salary = salary ;
36+ }
37+
38+ public void salaryIncrement (Double percentage ) {
39+ Double newSalary = salary + percentage * salary / 100 ;
40+ setSalary (newSalary );
41+ }
42+
43+ public String toString () {
44+ return "Id: " + id + " Name:" + name + " Price:" + salary ;
45+ }
46+ }
Original file line number Diff line number Diff line change 1+ package com .stackify .stream ;
2+
3+ import java .util .List ;
4+
5+ public class EmployeeRepository {
6+ private List <Employee > empList ;
7+
8+ public EmployeeRepository (List <Employee > empList ) {
9+ this .empList = empList ;
10+
11+ }
12+ public Employee findById (Integer id ) {
13+ for (Employee emp : empList ) {
14+ if (emp .getId () == id ) {
15+ return emp ;
16+ }
17+ }
18+
19+ return null ;
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments