Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for "ComparisonChain" #3

Open
rafakob opened this issue Feb 23, 2016 · 4 comments
Open

Support for "ComparisonChain" #3

rafakob opened this issue Feb 23, 2016 · 4 comments

Comments

@rafakob
Copy link

rafakob commented Feb 23, 2016

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 :)

@android10
Copy link
Owner

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.

@rafakob
Copy link
Author

rafakob commented Feb 24, 2016

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);
}

@Rainer-Lang
Copy link

@rafakob +1

@android10
Copy link
Owner

Will keep this in mind and label it as a feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants