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:
riking 2013-08-30 18:45:57 -07:00
parent 5c6cd57a4d
commit fe6ce01037

View File

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