Skip to content

Commit acfc14e

Browse files
committed
Agregando ejercicio de composicion
1 parent 8a6fe70 commit acfc14e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.platzi.functional.exercises;
2+
3+
import java.util.function.BiFunction;
4+
import java.util.function.Function;
5+
6+
public class _11_Composition {
7+
//TODO: Crear una funcion o grupo de funciones que puedan calcular: x^2 + y^2 + 2xy
8+
// usando unicamente los operadores: *, + una vez por funcion.
9+
// Es decir, Math.pow no esta permitido. y funciones del estilo: a * b + c no estan permitidas.
10+
public static BiFunction<Integer, Integer, Integer> generateEquation() {
11+
//Ejemplo:
12+
Function<Integer, Integer> toNegative = x -> -x;
13+
14+
//Y aqui tienes un regalo para este ejercicio (tienes que usar esta funcion en el codigo final):
15+
Function<Integer, Integer> multiplyBy2 = x -> x * 2;
16+
}
17+
}

0 commit comments

Comments
 (0)