Difference between revisions of "Comparator Assignment"
Jump to navigation
Jump to search
Line 16: | Line 16: | ||
==CompareApps== | ==CompareApps== | ||
+ | {{CodeToImplement|CompareApps|closestTo<br/>youngest<br/>mostPoints|compare.group}} | ||
+ | |||
===closestTo=== | ===closestTo=== | ||
<nowiki>public static Optional<Integer> closestTo(Integer[] values, int target)</nowiki> | <nowiki>public static Optional<Integer> closestTo(Integer[] values, int target)</nowiki> |
Revision as of 13:52, 15 September 2022
Contents
Group Assignment
This is a group assignment.
Background
Code To Implement
CompareUtils
class: | CompareUtils.java | |
methods: | min | |
package: | compare.group | |
source folder: | student/src/main/java |
min
public static <E> Optional<E> min(E[] array, Comparator<E> comparator)
CompareApps
class: | CompareApps.java | |
methods: | closestTo youngest mostPoints |
|
package: | compare.group | |
source folder: | student/src/main/java |
closestTo
public static Optional<Integer> closestTo(Integer[] values, int target)
youngest
public static Optional<HockeyPlayer> youngest(HockeyPlayer[] players)
mostPoints
public static Optional<HockeyPlayer> mostPoints(HockeyPlayer[] players)