Skip to content

Commit c65e918

Browse files
Constructor
1 parent 96e725b commit c65e918

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/main/java/com/java15/example/modern_java_in_action/Apple.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ public Apple(int weight){
1010
}
1111

1212
public Apple(int weight,String color) {
13-
this.weight = weight;this.color = color;
13+
this.weight = weight;
14+
this.color = color;
1415
}
1516

16-
public Apple() {
17-
18-
}
17+
public Apple() {}
1918

2019
public Integer getWeight() {
2120
return weight;

src/main/java/com/java15/example/modern_java_in_action/ch3_lambdaexpressions/Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private static void extracted5() {
2727
System.out.println(appleSupplier.get());
2828
Function<Integer,Apple> appleFunction = Apple::new;
2929
System.out.println(appleFunction.apply(10));
30-
BiFunction<Integer,String,Apple> appleBiFunction = (i,c)->new Apple(i,c);
30+
BiFunction<Integer,String,Apple> appleBiFunction = Apple::new;
3131
System.out.println(appleBiFunction.apply(10,Colors.RED));
3232
List<Integer> weights = Arrays.asList(7, 3, 4, 10);
3333
map(weights, Apple::new).forEach(System.out::println);

0 commit comments

Comments
 (0)