Skip to content

Commit 446a34c

Browse files
committed
Add Class to test Function java class.
This commit is for create a quick example for Function and Predicate.
1 parent 241008e commit 446a34c

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.froyo;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Data;
5+
import lombok.ToString;
6+
7+
@Data
8+
@AllArgsConstructor
9+
@ToString
10+
public class Fruit {
11+
12+
long id;
13+
String name;
14+
String country;
15+
16+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.froyo.junit5;
2+
3+
import com.froyo.Fruit;
4+
import org.apache.commons.lang3.StringUtils;
5+
import org.junit.jupiter.api.Test;
6+
7+
import java.math.BigDecimal;
8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Objects;
11+
12+
public class ProbandoCollectionSetUpdate {
13+
14+
@Test
15+
public void test(){
16+
17+
List<Fruit> fruits = new ArrayList<>();
18+
fruits.add(new Fruit(1L, "Apple", "India"));
19+
fruits.add(new Fruit(2L, "Pineapple", "India"));
20+
fruits.add(new Fruit(3L, "Kiwi", "New Zealand"));
21+
22+
fruits.forEach(f -> f.setName(f.getName() + "s-FROYO"));
23+
24+
System.out.println(fruits);
25+
26+
// BigDecimal bigDecimal = null;
27+
BigDecimal bigDecimal = new BigDecimal("25.2535");
28+
// System.out.println(StringUtils.defaultIfBlank(bigDecimal,StringUtils.SPACE));
29+
System.out.println("Hay un"+Objects.toString(bigDecimal,StringUtils.SPACE)+"espacio.");
30+
31+
}
32+
33+
}

0 commit comments

Comments
 (0)