@@ -694,6 +694,22 @@ public Integer apply(Integer item) {
694694 }
695695 });
696696 assertEquals ("2" , resultComp .toString ());
697+ class Person {
698+ public final String name ;
699+ public final Integer age ;
700+ public Person (final String name , final Integer age ) {
701+ this .name = name ;
702+ this .age = age ;
703+ }
704+ };
705+ final Person resultPerson = _ .max (asList (new Person ("moe" , 40 ), new Person ("larry" , 50 ), new Person ("curly" , 60 )),
706+ new Function1 <Person , Integer >() {
707+ public Integer apply (Person item ) {
708+ return item .age ;
709+ }
710+ });
711+ assertEquals ("curly" , resultPerson .name );
712+ assertEquals (60 , resultPerson .age );
697713 }
698714
699715/*
@@ -712,6 +728,22 @@ public Integer apply(Integer item) {
712728 }
713729 });
714730 assertEquals ("1000" , resultComp .toString ());
731+ class Person {
732+ public final String name ;
733+ public final Integer age ;
734+ public Person (final String name , final Integer age ) {
735+ this .name = name ;
736+ this .age = age ;
737+ }
738+ };
739+ final Person resultPerson = _ .min (asList (new Person ("moe" , 40 ), new Person ("larry" , 50 ), new Person ("curly" , 60 )),
740+ new Function1 <Person , Integer >() {
741+ public Integer apply (Person item ) {
742+ return item .age ;
743+ }
744+ });
745+ assertEquals ("moe" , resultPerson .name );
746+ assertEquals (40 , resultPerson .age );
715747 }
716748
717749/*
0 commit comments