java 8 stream · ram145/java8@0a5ebe5 · GitHub
Skip to content

Commit 0a5ebe5

Browse files
authored
java 8 stream
1 parent f073aa8 commit 0a5ebe5

4 files changed

Lines changed: 146 additions & 0 deletions

File tree

demo/ForEachDemo.java

Lines changed: 49 additions & 0 deletions

example/DataBase.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.javatechie.stream.api.example;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
//DAO layer
6+
public class DataBase {
7+
8+
public static List<Employee> getEmployees() {
9+
List<Employee> list = new ArrayList<>();
10+
list.add(new Employee(176, "Roshan", "IT", 600000));
11+
list.add(new Employee(388, "Bikash", "CIVIL", 900000));
12+
list.add(new Employee(470, "Bimal", "DEFENCE", 500000));
13+
list.add(new Employee(624, "Sourav", "CORE", 400000));
14+
list.add(new Employee(176, "Prakash", "SOCIAL", 1200000));
15+
return list;
16+
}
17+
18+
}

example/Employee.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.javatechie.stream.api.example;
2+
3+
public class Employee {
4+
5+
private int id;
6+
private String name;
7+
private String dept;
8+
private long salary;
9+
10+
public int getId() {
11+
return id;
12+
}
13+
14+
public void setId(int id) {
15+
this.id = id;
16+
}
17+
18+
public String getName() {
19+
return name;
20+
}
21+
22+
public void setName(String name) {
23+
this.name = name;
24+
}
25+
26+
public String getDept() {
27+
return dept;
28+
}
29+
30+
public void setDept(String dept) {
31+
this.dept = dept;
32+
}
33+
34+
public long getSalary() {
35+
return salary;
36+
}
37+
38+
public void setSalary(long salary) {
39+
this.salary = salary;
40+
}
41+
42+
public Employee(int id, String name, String dept, long salary) {
43+
super();
44+
this.id = id;
45+
this.name = name;
46+
this.dept = dept;
47+
this.salary = salary;
48+
}
49+
50+
public Employee() {
51+
super();
52+
// TODO Auto-generated constructor stub
53+
}
54+
55+
@Override
56+
public String toString() {
57+
return "Employee [id=" + id + ", name=" + name + ", dept=" + dept + ", salary=" + salary + "]";
58+
}
59+
60+
}

example/TaxService.java

Lines changed: 19 additions & 0 deletions

0 commit comments

Comments
 (0)