michael-o commented on a change in pull request #147: Time values
URL: 
https://github.com/apache/httpcomponents-core/pull/147#discussion_r321975511
 
 

 ##########
 File path: httpcore5/src/main/java/org/apache/hc/core5/util/TimeValue.java
 ##########
 @@ -371,13 +347,43 @@ public int toSecondsIntBound() {
         return asBoundInt(toSeconds());
     }
 
+    public Timeout toTimeout() {
+        return Timeout.of(duration, timeUnit);
+    }
+
     @Override
-    public String toString() {
-        return String.format(Locale.ROOT, "%,d %s", duration, timeUnit);
+    public int compareTo(final TimeValue other) {
+        if (other != null) {
+            final TimeUnit targetTimeUnit = min(other.getTimeUnit());
+            return Long.compare(convert(targetTimeUnit), 
other.convert(targetTimeUnit));
+        } else {
+            return -Integer.MAX_VALUE;
+        }
     }
 
-    public Timeout toTimeout() {
-        return Timeout.of(duration, timeUnit);
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof TimeValue) {
+            final TimeValue that = (TimeValue) obj;
+            return this.duration == that.duration && 
LangUtils.equals(this.timeUnit, that.timeUnit);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
 
 Review comment:
   Alright, should be taken in a separate PR.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to