Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit529adc6

Browse files
Java Stream Flat Map Example
1 parent69d02eb commit529adc6

File tree

10 files changed

+393
-0
lines changed

10 files changed

+393
-0
lines changed

‎JavaStreamFlatMapExample/.idea/encodings.xml‎

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎JavaStreamFlatMapExample/.idea/misc.xml‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎JavaStreamFlatMapExample/.idea/modules.xml‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎JavaStreamFlatMapExample/.idea/workspace.xml‎

Lines changed: 143 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<moduletype="JAVA_MODULE"version="4">
3+
<componentname="NewModuleRootManager"inherit-compiler-output="true">
4+
<exclude-output />
5+
<contenturl="file://$MODULE_DIR$">
6+
<sourceFolderurl="file://$MODULE_DIR$/src"isTestSource="false" />
7+
</content>
8+
<orderEntrytype="inheritedJdk" />
9+
<orderEntrytype="sourceFolder"forTests="false" />
10+
</component>
11+
</module>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
packagecom.javadevzone;
2+
3+
importjava.util.ArrayList;
4+
importjava.util.Arrays;
5+
importjava.util.HashSet;
6+
importjava.util.Set;
7+
8+
/**
9+
* Created by java developer zone on 5/21/2017.
10+
*/
11+
publicclassEmployeeimplementsComparable<Employee>{
12+
privateintno;
13+
privateStringname;
14+
privateStringdesignation;
15+
privateStringgender;
16+
privateSet<String>languages;
17+
18+
publicSet<String>getLanguages() {
19+
returnlanguages;
20+
}
21+
22+
publicEmployee(intno,Stringname,Stringdesignation,Stringgender ,String []languages) {
23+
this.no =no;
24+
this.name =name;
25+
26+
this.designation =designation;
27+
this.gender =gender;
28+
this.languages =newHashSet<>(Arrays.asList(languages));
29+
}
30+
31+
publicvoidaddLanguage(Stringlanguage){
32+
this.languages.add(language);
33+
}
34+
35+
publicintgetNo() {
36+
returnno;
37+
}
38+
publicvoidsetNo(intno) {
39+
this.no =no;
40+
}
41+
publicStringgetName() {
42+
returnname;
43+
}
44+
publicvoidsetName(Stringname) {
45+
this.name =name;
46+
}
47+
publicStringgetDesignation() {
48+
returndesignation;
49+
}
50+
publicvoidsetDesignation(Stringdesignation) {
51+
this.designation =designation;
52+
}
53+
publicStringgetGender() {
54+
returngender;
55+
}
56+
publicvoidsetGender(Stringgender) {
57+
this.gender =gender;
58+
}
59+
@Override
60+
publicStringtoString() {
61+
returnthis.no +" : " +this.name +" : " +gender +" : " +designation;
62+
}
63+
64+
@Override
65+
publicinthashCode() {
66+
inthashno =7;
67+
hashno =13 *hashno + (name ==null ?0 :name.hashCode());
68+
returnhashno;
69+
}
70+
71+
@Override
72+
publicbooleanequals(Objectobj) {
73+
if (obj ==null) {
74+
returnfalse;
75+
}
76+
finalEmployeestd = (Employee)obj;
77+
if (this ==std) {
78+
returntrue;
79+
}else {
80+
return (this.name.equals(std.name)
81+
&& (this.no ==std.no)) && (this.designation.equals(std.designation))
82+
&& (this.gender.equals(std.gender));
83+
}
84+
}
85+
86+
publicstaticjava.util.List<Employee>getEmployee() {
87+
java.util.List<Employee>employees =newArrayList<>();
88+
employees.add(newEmployee(1,"Bob","Developer","Male",newString[]{"java","scala"}));
89+
employees.add(newEmployee(2,"Joy","Sr. Developer","Male",newString[]{"java"}));
90+
employees.add(newEmployee(3,"John","CEO","Male",newString[]{"python","ruby"}));
91+
employees.add(newEmployee(4,"Bat","Developer","Male",newString[]{"scala"}));
92+
employees.add(newEmployee(5,"Jolly","Developer","Female",newString[]{"C","C++"}));
93+
employees.add(newEmployee(6,"Bobby","Developer","Female",newString[]{".Net","VB"}));
94+
returnemployees;
95+
}
96+
97+
@Override
98+
publicintcompareTo(Employeeo) {
99+
returnname.compareTo(o.getName());
100+
}
101+
102+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp