arrow
arrow copied to clipboard
Support for "ComparisonChain"
Hi, great job, sir! :) I often include Guava in my projects, but I always end up using like 1% of it (mostly collections and predicates). The problem on Android is it's huge methods footprint, which I guess your lib is trying to solve.
I have only one request. Could you add class ComparisonChain? It has almost none dependencies, shouldn't be a problem :)
Hey @rafakob thanks for the input here. I do wanna carefully pick what to add to the library since It might loose its main feature which is to stay tiny :). (I do not wanna end up with a big library)
Could you provide more context/information or use cases? Specially for android.
You meant use cases of other parts of Guava or just that ComparisonChain?
I like to use it with Ordering class, eg:
private List<User> orderData (List <User>list) {
return new Ordering<User>() {
@Override
public int compare(User left, User right) {
return ComparisonChain.start()
.compare(left.age(), right.age())
.compare(left.getLastname(), right.getLastname())
.compare(left.getFirstname(), right.getFirstname())
.result();
}
}.sortedCopy(list);
}
@rafakob +1
Will keep this in mind and label it as a feature request.