java.lang.Object
cs1302.oracle.model.Person.Order
- Enclosing class:
- Person
Implementations of
Comparable<Person>
that
impose various orderings.-
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends Comparable<? super R>>
Comparator<Person>by
(Person.Mapper<R> mapper) Returns a comparator forPerson
objects that performs comparisons using the natural ordering of the results of applying the givenmapper
function to the person objects under comparison.static Comparator<Person>
byAge()
Returns a comparator forPerson
objects that performs comparisons using the natural ordering of the age values of the person objects under comparison.static Comparator<Person>
byName()
Returns a comparator forPerson
objects that performs comparisons using the natural ordering of the name values of the person objects under comparision.static Comparator<Person>
Returns a comparator forPerson
objects that performs comparisons according to the natural ordering of the person objects under comparision.
-
Method Details
-
by
Returns a comparator forPerson
objects that performs comparisons using the natural ordering of the results of applying the givenmapper
function to the person objects under comparison.- Type Parameters:
R
- the return type ofmapper.apply(Person)
- Parameters:
mapper
- a function that returns a comparable value for a person- Returns:
- a comparator for
Person
objects
-
byAge
Returns a comparator forPerson
objects that performs comparisons using the natural ordering of the age values of the person objects under comparison.- Returns:
- a comparator that compares
Person
objects by age
-
byName
Returns a comparator forPerson
objects that performs comparisons using the natural ordering of the name values of the person objects under comparision.- Returns:
- a comparator that compares
Person
objects by name
-
naturally
Returns a comparator forPerson
objects that performs comparisons according to the natural ordering of the person objects under comparision.- Returns:
- a comparator that compares
Person
objects naturally
-