-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathComplicatedObject.java
More file actions
48 lines (42 loc) Β· 1.06 KB
/
Copy pathComplicatedObject.java
File metadata and controls
48 lines (42 loc) Β· 1.06 KB
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
43
44
45
46
47
48
package day9;
public class ComplicatedObject {
int height;
int width;
int breadth;
int x;
int y;
private ComplicatedObject(int height, int width, int breadth, int x, int y) {
this.height = height;
this.width = width;
this.breadth = breadth;
this.x = x;
this.y = y;
}
public static class Builder {
int height;
int width;
int breadth;
int x;
int y;
public Builder withDimensions(int height, int width, int breadth) {
this.height = height;
this.width = width;
this.breadth = breadth;
return this;
}
public Builder withPosition(int x, int y) {
this.x = x;
this.y = y;
return this;
}
public ComplicatedObject build() {
return new ComplicatedObject(
this.height,
this.height,
this.breadth,
this.x,
this.y
);
}
}
}