#502 Replaced usages of System.out with logger.
This commit is contained in:
@ -37,6 +37,8 @@ import com.iluwatar.specification.property.Color;
|
||||
import com.iluwatar.specification.property.Movement;
|
||||
import com.iluwatar.specification.selector.ColorSelector;
|
||||
import com.iluwatar.specification.selector.MovementSelector;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -52,6 +54,8 @@ import com.iluwatar.specification.selector.MovementSelector;
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
@ -62,22 +66,22 @@ public class App {
|
||||
Arrays.asList(new Goblin(), new Octopus(), new Dragon(), new Shark(), new Troll(),
|
||||
new KillerBee());
|
||||
// find all walking creatures
|
||||
System.out.println("Find all walking creatures");
|
||||
LOGGER.info("Find all walking creatures");
|
||||
List<Creature> walkingCreatures =
|
||||
creatures.stream().filter(new MovementSelector(Movement.WALKING))
|
||||
.collect(Collectors.toList());
|
||||
walkingCreatures.stream().forEach(System.out::println);
|
||||
walkingCreatures.stream().forEach(c -> LOGGER.info(c.toString()));
|
||||
// find all dark creatures
|
||||
System.out.println("Find all dark creatures");
|
||||
LOGGER.info("Find all dark creatures");
|
||||
List<Creature> darkCreatures =
|
||||
creatures.stream().filter(new ColorSelector(Color.DARK)).collect(Collectors.toList());
|
||||
darkCreatures.stream().forEach(System.out::println);
|
||||
darkCreatures.stream().forEach(c -> LOGGER.info(c.toString()));
|
||||
// find all red and flying creatures
|
||||
System.out.println("Find all red and flying creatures");
|
||||
LOGGER.info("Find all red and flying creatures");
|
||||
List<Creature> redAndFlyingCreatures =
|
||||
creatures.stream()
|
||||
.filter(new ColorSelector(Color.RED).and(new MovementSelector(Movement.FLYING)))
|
||||
.collect(Collectors.toList());
|
||||
redAndFlyingCreatures.stream().forEach(System.out::println);
|
||||
redAndFlyingCreatures.stream().forEach(c -> LOGGER.info(c.toString()));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user