io.norberg.automatter.example.ComparableList Maven / Gradle / Ivy
package io.norberg.automatter.example;
import java.util.ArrayList;
import java.util.Collection;
import static java.util.Arrays.asList;
public class ComparableList extends ArrayList implements Comparable> {
public ComparableList(final Collection extends T> values) {
super(values);
}
public static ComparableList of(final Collection extends T> values) {
return new ComparableList<>(values);
}
@SafeVarargs
public static ComparableList of(final T... values) {
return new ComparableList<>(asList(values));
}
@Override
public int compareTo(final ComparableList o) {
return Integer.compare(size(), o.size());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy