package mylambdaexamples;
import java.time.LocalDate;
import java.util.LinkedHashSet;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
public class MyLambdaExamples {
public static void main(String[] args) {
// Person 表示
System.out.println("\n<-- Person 表示 -->");
persons.forEach((e) -> {
e.printPerson();
});
}
// Persons
private static final Person kyouhei = new Person("柴田", "恭平", LocalDate.of(1951, 8, 18), Person.Sex.MALE);
private static final Person mitsu = new Person("壇", "蜜", LocalDate.of(1980, 12, 3), Person.Sex.FEMALE);
private static final Person keiko = new Person("北川", "景子", LocalDate.of(1986, 8, 22), Person.Sex.FEMALE);
private static final Person haruka = new Person("綾瀬", "はるか", LocalDate.of(1985, 3, 24), Person.Sex.FEMALE);
private static final Person nozomi = new Person("佐々木", "希", LocalDate.of(1988, 2, 8), Person.Sex.FEMALE);
private static final Person ayame = new Person("剛力", "彩芽", LocalDate.of(1992, 8, 27), Person.Sex.FEMALE);
private static final Person syun = new Person("小栗", "旬", LocalDate.of(1982, 12, 26), Person.Sex.MALE);
private static final Person maki = new Person("堀北", "真希", LocalDate.of(1988, 10, 6), Person.Sex.FEMALE);
private static final Person saki = new Person("武井", "咲", LocalDate.of(1993, 12, 25), Person.Sex.FEMALE);
private static final Person hayato = new Person("市原", "隼人", LocalDate.of(1987, 2, 6), Person.Sex.MALE);
private static final Person kyouko = new Person("深田", "恭子", LocalDate.of(1982, 11, 2), Person.Sex.FEMALE);
// Wristwatches
private static final Wristwatch rolex = new Wristwatch("ロレックス", "プレシジョン", 1_950, 800_000);
private static final Wristwatch cartier = new Wristwatch("カルティエ", "マストタンク", 1_980, 500_000);
private static final Wristwatch tiffany = new Wristwatch("ティファニー", "ポーセリン", 1_920, 1_500_000);
private static final Wristwatch tudor = new Wristwatch("チュードル", "カメレオン", 1_960, 650_000);
private static final Wristwatch omega = new Wristwatch("オメガ", "ダイナミックデビル", 1_960, 600_000);
// Sales
private static final Sale kyouhei_From_mitsu = new Sale(kyouhei, mitsu, rolex, 400_000);
private static final Sale keiko_From_haruka = new Sale(keiko, haruka, cartier, 250_000);
private static final Sale nozomi_From_ayame = new Sale(nozomi, ayame, tudor, 330_000);
private static final Sale maki_From_syun = new Sale(maki, syun, omega, 300_000);
private static final Sale kyouko_From_hayato = new Sale(kyouko, hayato, tiffany, 1_000_000);
private static final Sale kyouko_From_saki = new Sale(kyouko, saki, tiffany, 900_000);
private static final Sale kyouko_From_keiko = new Sale(kyouko, keiko, cartier, 200_000);
private static final Sale kyouko_From_haruka = new Sale(kyouko, haruka, rolex, 300_000);
private static final Sale kyouhei_From_haruka = new Sale(kyouko, haruka, tiffany, 800_000);
private static final Sale saki_From_haruka = new Sale(saki, haruka, omega, 300_000);
private static final Sale haruka_From_kyouko = new Sale(haruka, kyouko, tudor, 400_000);
// Collections
private static final Stream<Person> persons = new LinkedHashSet<>(asList(
kyouhei,
mitsu,
keiko,
haruka,
nozomi,
ayame,
syun,
maki,
saki,
hayato,
kyouko)).stream();
private static final Stream<Wristwatch> wristwatches = new LinkedHashSet<>(asList(
rolex,
cartier,
tiffany,
tudor,
omega)).stream();
private static final Stream<Sale> sales = new LinkedHashSet<>(asList(
kyouhei_From_mitsu,
keiko_From_haruka,
nozomi_From_ayame,
maki_From_syun,
kyouko_From_hayato,
kyouko_From_saki,
kyouko_From_keiko,
kyouko_From_haruka,
kyouhei_From_haruka,
saki_From_haruka,
haruka_From_kyouko)).stream();
}