Difference between revisions of "Comparator Assignment"

From CSE231 Wiki
Jump to navigation Jump to search
Line 6: Line 6:
  
 
==CompareApps==
 
==CompareApps==
 +
===closestTo===
 +
<nowiki>public static Optional<Integer> closestTo(Integer[] values, int target)</nowiki>
 +
===youngest===
 +
<nowiki>public static Optional<HockeyPlayer> youngest(HockeyPlayer[] players)</nowiki>
 +
===mostPoints===
 +
<nowiki>public static Optional<HockeyPlayer> mostPoints(HockeyPlayer[] players)</nowiki>

Revision as of 16:51, 2 November 2021

Background

Comparator<T>

Code To Implement

CompareUtils

min

CompareApps

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)