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 forPersonobjects that performs comparisons using the natural ordering of the results of applying the givenmapperfunction to the person objects under comparison.static Comparator<Person>byAge()Returns a comparator forPersonobjects that performs comparisons using the natural ordering of the age values of the person objects under comparison.static Comparator<Person>byName()Returns a comparator forPersonobjects that performs comparisons using the natural ordering of the name values of the person objects under comparision.static Comparator<Person>Returns a comparator forPersonobjects that performs comparisons according to the natural ordering of the person objects under comparision.
-
Method Details
-
by
Returns a comparator forPersonobjects that performs comparisons using the natural ordering of the results of applying the givenmapperfunction 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
Personobjects
-
byAge
Returns a comparator forPersonobjects that performs comparisons using the natural ordering of the age values of the person objects under comparison.- Returns:
- a comparator that compares
Personobjects by age
-
byName
Returns a comparator forPersonobjects that performs comparisons using the natural ordering of the name values of the person objects under comparision.- Returns:
- a comparator that compares
Personobjects by name
-
naturally
Returns a comparator forPersonobjects that performs comparisons according to the natural ordering of the person objects under comparision.- Returns:
- a comparator that compares
Personobjects naturally
-