Skip to content

Commit dce25e9

Browse files
committed
fix on examples, updated dependencies versions
1 parent fa947b2 commit dce25e9

2 files changed

Lines changed: 22 additions & 18 deletions

File tree

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ allprojects {
1414
}
1515

1616
dependencies {
17-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
18-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
17+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
18+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
1919
}
2020
}
2121

@@ -31,8 +31,8 @@ project(':jobs-search-reporter') {
3131
}
3232

3333
dependencies {
34-
implementation 'com.beust:jcommander:1.81'
35-
implementation 'io.github.openfeign:feign-core:12.3'
36-
implementation 'io.github.openfeign:feign-gson:12.3'
34+
implementation 'com.beust:jcommander:1.82'
35+
implementation 'io.github.openfeign:feign-core:13.3'
36+
implementation 'io.github.openfeign:feign-gson:13.3'
3737
}
3838
}

modules/src/main/java/com/platzi/functional_student_practice/_08_lambda/Syntax.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import java.util.List;
66
import java.util.function.BiFunction;
7-
import java.util.function.Function;
8-
import java.util.function.IntBinaryOperator;
97
import java.util.function.Predicate;
108

119
public class Syntax {
@@ -27,7 +25,7 @@ public static void main(String[] args) {
2725

2826

2927
// no input, 1 return
30-
useZeroParameters(() -> 2);
28+
System.out.println(useZeroParameters(() -> 2));
3129
// SAME AS USING THIS:
3230
// useZeroParameters(new ZeroArguments() {
3331
// @Override
@@ -38,7 +36,7 @@ public static void main(String[] args) {
3836

3937

4038
// 1 input, 1 return
41-
usePredicate(text -> text.isEmpty());
39+
System.out.println(usePredicate(text -> text.isEmpty(), ""));
4240
// SAME AS USING THIS:
4341
// usePredicate(new Predicate<String>() {
4442
// @Override
@@ -49,8 +47,8 @@ public static void main(String[] args) {
4947

5048

5149
// 2 inputs, 1 return
52-
useBiFunction((Integer x, Integer y) -> x * y);
53-
useBiFunction((x, y) -> x * y);
50+
System.out.println(useBiFunction((Integer x, Integer y) -> x * y, 2, 3));
51+
System.out.println(useBiFunction((x, y) -> x * y, 4, 5));
5452
// SAME AS USING THIS:
5553
// useBiFunction(new BiFunction<>() {
5654
// @Override
@@ -66,14 +64,16 @@ public static void main(String[] args) {
6664

6765

6866
// 2 inputs, 1 return
69-
useBiFunction((x, y) -> {
67+
System.out.println(useBiFunction((x, y) -> {
7068
System.out.println("X: " + x + ", Y:" + y);
7169
return x - y;
72-
});
70+
}, 6, 7));
7371

7472

7573
// no input, no return
76-
useNothing(() -> System.out.println("Hola Alumno"));
74+
useNothing(() -> {
75+
});
76+
useNothing(() -> System.out.println("Me ejecute sin recibir ni devolver elementos"));
7777
// SAME AS USING THIS:
7878
// useNothing(new DoNothing() {
7979
// @Override
@@ -84,19 +84,23 @@ public static void main(String[] args) {
8484

8585
}
8686

87-
static void useZeroParameters(ZeroArguments zeroArguments) {
87+
static int useZeroParameters(ZeroArguments lamda) {
88+
return lamda.get();
8889
// static class to implement FunctionalInterface
8990
}
9091

91-
static void usePredicate(Predicate<String> predicado) {
92+
static boolean usePredicate(Predicate<String> lamda, String text) {
93+
return lamda.test(text);
9294
// static class to implement FunctionalInterface
9395
}
9496

95-
static void useBiFunction(BiFunction<Integer, Integer, Integer> operacion) {
97+
static Integer useBiFunction(BiFunction<Integer, Integer, Integer> lamda, Integer x, Integer y) {
98+
return lamda.apply(x, y);
9699
// static class to implement FunctionalInterface
97100
}
98101

99-
static void useNothing(DoNothing doNothing) {
102+
static void useNothing(DoNothing lambda) {
103+
lambda.nothing();
100104
// static class to implement FunctionalInterface
101105
}
102106

0 commit comments

Comments
 (0)