diff --git a/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java b/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java deleted file mode 100644 index 139475bc25..0000000000 --- a/core-java-8/src/main/java/com/baeldung/java_8_features/Car.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.java_8_features; - -public class Car { - - private String model; - private int topSpeed; - - public Car(String model, int topSpeed) { - super(); - this.model = model; - this.topSpeed = topSpeed; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public int getTopSpeed() { - return topSpeed; - } - - public void setTopSpeed(int topSpeed) { - this.topSpeed = topSpeed; - } - - -} diff --git a/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java b/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java index 55caeeba5e..4979338452 100644 --- a/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java +++ b/core-java-8/src/test/java/com/baeldung/java8/Java8MaxMinUnitTest.java @@ -1,7 +1,6 @@ package com.baeldung.java8; import com.baeldung.java_8_features.Person; -import com.baeldung.java_8_features.Car; import org.junit.Test; import java.util.Arrays; @@ -45,29 +44,4 @@ public class Java8MaxMinUnitTest { assertEquals("Should be Alex", alex, minByAge); } - @Test - public void whenArrayIsOfIntegerThenMinCanBeDoneUsingIntegerComparator() { - int[] integers = new int[] { 20, 98, 12, 7, 35 }; - - int min = Arrays.stream(integers) - .min() - .getAsInt(); - - assertEquals(7, min); - } - - @Test - public void whenArrayIsOfPersonObjectThenMaxCanBeDoneUsingCustomComparatorThroughLambda() { - final Car porsche = new Car("Porsche 959", 319); - final Car ferrari = new Car("Ferrari 288 GTO", 303); - final Car bugatti = new Car("Bugatti Veyron 16.4 Super Sport", 415); - final Car mcLaren = new Car("McLaren F1", 355); - final Car[] fastCars = { porsche, ferrari, bugatti, mcLaren }; - - final Car maxBySpeed = Arrays.stream(fastCars) - .max(Comparator.comparing(Car::getTopSpeed)) - .orElseThrow(NoSuchElementException::new); - - assertEquals(bugatti, maxBySpeed); - } }