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.

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

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

23 changes: 23 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.

11 changes: 11 additions & 0 deletions LambdasLab/java/CheckForSelectiveService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import com.sun.tools.javac.comp.Check;

public class CheckForSelectiveService implements CheckPerson {

@Override
public Boolean test(Person person) {
return person.gender == Person.Sex.MALE &&
person.getAge() >= 18 &&
person.getAge() <= 25;
}
}
7 changes: 7 additions & 0 deletions LambdasLab/java/CheckPerson.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public interface CheckPerson {
//This is the search criteria

Boolean test(Person person);
//classes will implement the specific search criteria

}
69 changes: 69 additions & 0 deletions LambdasLab/java/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import java.time.LocalDate;
import java.time.Month;
import java.util.ArrayList;
import java.util.List;

public class Main {


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


public static void main(String[] args) {
Person tp, tp1, tp2, tp3, tp4;
ArrayList<Person> myPeeps = new ArrayList<>();

tp = new Person("Ricardo Jiminez", LocalDate.of(1990, Month.APRIL, 22), Person.Sex.MALE, "RickyBaby@gmail.com");
tp1 = new Person("Sarah Jiminez", LocalDate.of(1970, Month.AUGUST, 12), Person.Sex.FEMALE, "SarahBaby@gmail.com");
tp2 = new Person("Martha Stewart", LocalDate.of(1980, Month.JULY, 18), Person.Sex.MALE, "CookBaby@gmail.com");
tp3 = new Person("JimBob Johnson", LocalDate.of(2001, Month.MARCH, 7), Person.Sex.MALE, "JimBob@gmail.com");
tp4 = new Person("Ol Man Tucker", LocalDate.of(2003, Month.MAY, 22), Person.Sex.MALE, "Tuck@gmail.com");
myPeeps.add(tp1);
myPeeps.add(tp2);
myPeeps.add(tp3);
myPeeps.add(tp4);
myPeeps.add(tp);



//Example of a local class
class checkForOver18 implements CheckPerson {
@Override //Function we're implementing from the Interface below
public Boolean test(Person person) {
return person.getAge() >= 18;
}
}
printPersons(myPeeps, new checkForOver18());


//Example using an anonymous class
printPersons(myPeeps, new CheckPerson() {
@Override // Function we're implementing from the interface below
public Boolean test(Person person) {
return person.getAge() >= 18;
}
});


//Example using an lambdas
printPersons(myPeeps, person -> person.getAge() >= 45);

}









}

Loading