Skip to content

Commit daa33b3

Browse files
committed
Chaining y chainer
1 parent cb94352 commit daa33b3

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

  • modules/src/main/java/com/platzi/functional/_10_chaining
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.platzi.functional._10_chaining;
2+
3+
public class Chaining {
4+
public static void main(String[] args) {
5+
StringBuilder stringBuilder = new StringBuilder();
6+
stringBuilder.append("Hola")
7+
.append("alumno")
8+
.append("de")
9+
.append("platzi");
10+
11+
Chainer chainer = new Chainer();
12+
13+
Chainer chainer2 = chainer.sayHi();
14+
Chainer chainer3 = chainer2.sayBye();
15+
chainer.sayHi().sayBye();
16+
}
17+
18+
static class Chainer {
19+
public Chainer sayHi() {
20+
System.out.println("Hola");
21+
return this;
22+
}
23+
24+
public Chainer sayBye() {
25+
System.out.println("Bye");
26+
return this;
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)