BAEL-376 - Adding more test code

This commit is contained in:
slavisa-baeldung
2016-12-03 10:53:17 +01:00
parent 287fbc3b10
commit 1a7f172587
7 changed files with 65 additions and 48 deletions

View File

@@ -1,5 +1,12 @@
package com.baeldung.generics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Building {
private static final Logger LOGGER = LoggerFactory.getLogger(Building.class);
public void paint() {
LOGGER.info("Building");
}
}

View File

@@ -1,3 +1,5 @@
package com.baeldung.generics;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -21,9 +23,7 @@ public class Generics {
// example of a generic method with a wild card, this method can be used
// with a list of any subtype of Building
public static boolean paintAllBuildings(List<? extends Building> buildings) {
for (Building building : buildings) {
building.paint();
}
buildings.stream().forEach(Building::paint);
return true;
}

View File

@@ -0,0 +1,12 @@
package com.baeldung.generics;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class House extends Building {
private static final Logger LOGGER = LoggerFactory.getLogger(House.class);
public void paint() {
LOGGER.info("House");
}
}

View File

@@ -1,4 +0,0 @@
public class SubBuilding extends Building {
}