mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 09:25:54 +00:00
* Use java 11 * Use .of - Replace Arrays.asList with List.of - Replace HashSet<>(List.of()) with Set.of * Formatting
This commit is contained in:
@@ -23,13 +23,12 @@
|
||||
|
||||
package com.iluwatar.collectionpipeline;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* In imperative-style programming, it is common to use for and while loops for
|
||||
* most kinds of data processing. Function composition is a simple technique
|
||||
@@ -67,11 +66,11 @@ public class App {
|
||||
LOGGER.info(groupingByCategoryFunctional.toString());
|
||||
|
||||
Person john = new Person(cars);
|
||||
|
||||
List<Car> sedansOwnedImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(Arrays.asList(john));
|
||||
|
||||
List<Car> sedansOwnedImperative = ImperativeProgramming.getSedanCarsOwnedSortedByDate(List.of(john));
|
||||
LOGGER.info(sedansOwnedImperative.toString());
|
||||
|
||||
List<Car> sedansOwnedFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(Arrays.asList(john));
|
||||
List<Car> sedansOwnedFunctional = FunctionalProgramming.getSedanCarsOwnedSortedByDate(List.of(john));
|
||||
LOGGER.info(sedansOwnedFunctional.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user