Define hashCode() for TimeUnit as it is being used in a HashMap
TimeUnit is being used as the key to a map in TimeDiffUtil, so we must define a hashCode() consistent with its equals() method. The implementation is the same as java.lang.Long.hashCode().
This commit is contained in:
parent
5c6cd57a4d
commit
fe6ce01037
@ -148,4 +148,10 @@ public class TimeUnit implements Comparable<TimeUnit>
|
||||
return this.millis == ((TimeUnit)other).millis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode()
|
||||
{
|
||||
return (int)(this.millis^(this.millis>>>32));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user