* 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,17 +23,7 @@
|
||||
|
||||
package com.iluwatar.specification.app;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.iluwatar.specification.creature.Creature;
|
||||
import com.iluwatar.specification.creature.Dragon;
|
||||
import com.iluwatar.specification.creature.Goblin;
|
||||
import com.iluwatar.specification.creature.KillerBee;
|
||||
import com.iluwatar.specification.creature.Octopus;
|
||||
import com.iluwatar.specification.creature.Shark;
|
||||
import com.iluwatar.specification.creature.Troll;
|
||||
import com.iluwatar.specification.creature.*;
|
||||
import com.iluwatar.specification.property.Color;
|
||||
import com.iluwatar.specification.property.Movement;
|
||||
import com.iluwatar.specification.selector.ColorSelector;
|
||||
@ -41,6 +31,9 @@ import com.iluwatar.specification.selector.MovementSelector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* The central idea of the Specification pattern is to separate the statement of how to match a
|
||||
@ -64,8 +57,7 @@ public class App {
|
||||
public static void main(String[] args) {
|
||||
// initialize creatures list
|
||||
List<Creature> creatures =
|
||||
Arrays.asList(new Goblin(), new Octopus(), new Dragon(), new Shark(), new Troll(),
|
||||
new KillerBee());
|
||||
List.of(new Goblin(), new Octopus(), new Dragon(), new Shark(), new Troll(), new KillerBee());
|
||||
// find all walking creatures
|
||||
LOGGER.info("Find all walking creatures");
|
||||
List<Creature> walkingCreatures =
|
||||
|
Reference in New Issue
Block a user