I am attempting to use the functional library TotallyLazy, in Java. I am programming in AIDE on Android. I have this code which doesn't work:
package net.intrepidis;
import java.util.Comparator;
import static com.googlecode.totallylazy.Sequences.sequence;
import static com.googlecode.totallylazy.comparators.Comparators.ascending;
public class FunctionalTest
{
public static void Go()
{
sequence(34, 25, 62)
.sort(ascending());
}
}
If I use this line instead then it works:
.sort((Comparator<Comparable>)ascending());
However, that looks wrong to me, and goes against the grain of the framework. What am I doing wrong? Is it just because the Java version used by AIDE doesn't allow for the abbreviated code?
You could also do
sequence(34, 25, 62)
.sort(Comparators.<Integer>ascending());
This is useful if the sequence is a generic type