I have reached the limit of my ability to deal with Java's type system. The scenario is this:
I have the need for a method that can take a Collection<Comparable> and a function that takes a Collection<Comparable> as an input and returns a single element from that collection.
That seems to be done like this:
private <T extends Comparable<T>> Comparable<T> applyFunctionOnStuff(
final Collection<Comparable<T>> stuff,
final Function<Collection<Comparable<T>>, Comparable<T>> function) {
return function.apply(stuff);
}
But then I have the inability to bend Collections::max to be a valid input for the function. I was wondering whether there is a way for me to wrap static methods like that into a Function class and use them inside this method.