Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .idea/$PRODUCT_WORKSPACE_FILE$

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/Lambdas2-ZCW.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__junit_junit_4_9.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions lambdas2zcw/lambdas2zcw.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Lambdas2-ZCW" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.9" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.github.stefanbirkner:system-rules:1.19.0" level="project" />
</component>
</module>
38 changes: 38 additions & 0 deletions lambdas2zcw/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.zipcodewilmington</groupId>
<artifactId>lambdas2zcw</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
<version>1.19.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>


</project>
4 changes: 4 additions & 0 deletions lambdas2zcw/src/main/java/CheckPerson.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public interface CheckPerson {

Boolean test(Person person);
}
46 changes: 46 additions & 0 deletions lambdas2zcw/src/main/java/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

public class Main {

public static void printPeople(List<Person> roster, CheckPerson tester) {
for (Person p : roster) {
if (tester.test(p)) {
p.printPerson();
}
}
}

public static void main(String[] args) {
Person aswomeSister, secondBestSister, thirdBestSister, olderSister;
ArrayList<Person> myFamily = new ArrayList<>();

aswomeSister = new Person("Charlotte Beale", LocalDate.of(1982, java.time.Month.AUGUST, 20), Person.Sex.FEMALE, "cbeale2000@gmail.com");
secondBestSister = new Person("Ruth Beale", LocalDate.of(1980, java.time.Month.MARCH, 07), Person.Sex.FEMALE, "rbeale@gmail.com");
thirdBestSister = new Person("Kesha Beale", LocalDate.of(1978, java.time.Month.AUGUST, 17), Person.Sex.FEMALE, "kbeale@gmail.com");
olderSister = new Person("Kathleen Beale", LocalDate.of(1976, java.time.Month.FEBRUARY, 23), Person.Sex.FEMALE, "kbeale@hotmail.com");
myFamily.add(aswomeSister);
myFamily.add(secondBestSister);
myFamily.add(thirdBestSister);
myFamily.add(olderSister);


class checkForOver18 implements CheckPerson {

@Override
public Boolean test(Person person) {
return person.getAge() >= 18;
}
}
printPeople(myFamily, new checkForOver18());

printPeople(myFamily, new CheckPerson() {
@Override
public Boolean test(Person person) {
return person.getAge() >= 18;
}
});
printPeople(myFamily, person -> person.getAge() >= 45);
}
}
Loading