FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java_upgrade/src/main/java/optional/Company.java at main · alcmontejo/java_upgrade · GitHub
alcmontejo
/
java_upgrade
Public
forked from
kousen/java_upgrade
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java_upgrade
/
src
/
main
/
java
/
optional
/
Company.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (32 loc) · 1.12 KB
Breadcrumbs
java_upgrade
/
src
/
main
/
java
/
optional
/
Company.java
Copy path
File metadata and controls
42 lines (32 loc) · 1.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
35
36
37
38
39
40
41
42
package
optional
;
import
java
.
util
.
Arrays
;
import
java
.
util
.
HashMap
;
import
java
.
util
.
Map
;
import
java
.
util
.
Optional
;
public
class
Company
{
private
final
String
name
;
private
final
Map
<
String
,
Department
>
departmentMap
=
new
HashMap
<>();
public
Company
(
String
name
) {
this
.
name
=
name
;
Department
it
=
new
Department
(
"IT"
);
Department
sales
=
new
Department
(
"Sales"
);
Department
finance
=
new
Department
(
"Finance"
);
Department
accounting
=
new
Department
(
"Accounting"
);
Manager
mrSlate
=
new
Manager
(
"Mr Slate"
);
Manager
mrBurns
=
new
Manager
(
"Mr Burns"
);
Manager
janeway
=
new
Manager
(
"Admiral Janeway"
);
sales
.
setManager
(
mrBurns
);
finance
.
setManager
(
mrSlate
);
accounting
.
setManager
(
janeway
);
Arrays
.
asList
(
it
,
sales
,
finance
,
accounting
).
forEach
(
dept
->
departmentMap
.
put
(
dept
.
getName
(),
dept
)
);
}
public
Optional
<
Department
>
getDepartment
(
String
name
) {
return
Optional
.
ofNullable
(
departmentMap
.
get
(
name
));
}
public
String
getName
() {
return
name
;
}
}
Back
|
FazBrowse Home
|
New Git URL