Why isn\'t the implementation of Math.max a variadic function?
It could get implemented like this:
public class Main {
public static double max(d
The java.lang.Math
has been introduced in JDK 1.0, long before variadic functions were introduced into the language in Java 5.
In addition, efficiency is a concern: if you need two elements most of the time, it is much faster to pass them "inline", without creating an intermediate array to hold them. This also avoids the costs of setting up a loop inside the implementation.