Skip to content

Commit 5f0eed9

Browse files
Ahmed TawilaAhmed Tawila
authored andcommitted
Future in Vavr - Initial Commit
1 parent 992c661 commit 5f0eed9

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.baeldung.vavr.future;
2+
3+
import static org.junit.Assert.assertEquals;
4+
import org.junit.Test;
5+
6+
import io.vavr.concurrent.Future;
7+
8+
public class Tester {
9+
10+
@Test
11+
public void start() {
12+
Future<Integer> resultFuture = Future.of(() -> addOne(4));
13+
Integer result = resultFuture.get();
14+
15+
assertEquals(5, (int) result);
16+
}
17+
18+
public Integer addOne(Integer num) {
19+
return num + 1;
20+
}
21+
22+
}

0 commit comments

Comments
 (0)