Making Duration comparable

Solves #754
I guess the only thing is it avoids doing a conversion so should be more
efficient. I don't feel strongly either way, but I do think the 2 classes
should behave the same way.
On 23 Oct 2014 09:19, "Jochen Schalanda" <notifications@github.com> wrote:

> In dropwizard-util/src/main/java/io/dropwizard/util/Duration.java:
>
> > @@ -149,4 +149,27 @@ public String toString() {
> >          }
> >          return Long.toString(count) + ' ' + units;
> >      }
> > +
> > +    @Override
> > +    public int compareTo(Duration other) {
> > +        if (count == 0 && other.count == 0) {
> > +            return 0;
> > +        }
> > +
> > +        // this is negative, other is non-negative
> > +        if (count < 0 && other.count >= 0) {
>
> I see that this is symmetric to the implementation in Size but are these
> short circuits really necessary? Long#compare() will usually just do the
> right thing™.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/dropwizard/dropwizard/pull/757/files#r19264268>.
>