@Test public void testHashCode() throws Exception { ResourceSpec rs1 = ResourceSpec.newBuilder().setCpuCores(1.0).setHeapMemoryInMB(100).build(); ResourceSpec rs2 = ResourceSpec.newBuilder().setCpuCores(1.0).setHeapMemoryInMB(100).build(); assertEquals(rs1.hashCode(), rs2.hashCode()); ResourceSpec rs3 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(2.2). build(); ResourceSpec rs4 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(1). build(); assertNotEquals(rs3.hashCode(), rs4.hashCode()); ResourceSpec rs5 = ResourceSpec.newBuilder(). setCpuCores(1.0). setHeapMemoryInMB(100). setGPUResource(2.2). build(); assertEquals(rs3.hashCode(), rs5.hashCode()); }
@Override public int hashCode() { final long cpuBits = Double.doubleToLongBits(cpuCores); int result = (int) (cpuBits ^ (cpuBits >>> 32)); result = 31 * result + heapMemoryInMB; result = 31 * result + directMemoryInMB; result = 31 * result + nativeMemoryInMB; result = 31 * result + stateSizeInMB; result = 31 * result + managedMemoryInMB; result = 31 * result + extendedResources.hashCode(); return result; }
ResourceSpec implements Serializable { @Override public int hashCode() { final long cpuBits = Double.doubleToLongBits(cpuCores); int result = (int) (cpuBits ^ (cpuBits >>> 32)); result = 31 * result + heapMemoryInMB; result = 31 * result + directMemoryInMB; result = 31 * result + nativeMemoryInMB; result = 31 * result + stateSizeInMB; result = 31 * result + managedMemoryInMB; result = 31 * result + extendedResources.hashCode(); return result; } }
ResourceSpec implements Serializable { @Override public int hashCode() { final long cpuBits = Double.doubleToLongBits(cpuCores); int result = (int) (cpuBits ^ (cpuBits >>> 32)); result = 31 * result + heapMemoryInMB; result = 31 * result + directMemoryInMB; result = 31 * result + nativeMemoryInMB; result = 31 * result + stateSizeInMB; result = 31 * result + managedMemoryInMB; result = 31 * result + extendedResources.hashCode(); return result; } private  ResourceSpec(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int stateSizeInMB,
			int managedMemoryInMB,
			Resource... extendedResources); private  ResourceSpec(); }
ResourceSpec implements Serializable { @Override public int hashCode() { final long cpuBits = Double.doubleToLongBits(cpuCores); int result = (int) (cpuBits ^ (cpuBits >>> 32)); result = 31 * result + heapMemoryInMB; result = 31 * result + directMemoryInMB; result = 31 * result + nativeMemoryInMB; result = 31 * result + stateSizeInMB; result = 31 * result + managedMemoryInMB; result = 31 * result + extendedResources.hashCode(); return result; } private  ResourceSpec(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int stateSizeInMB,
			int managedMemoryInMB,
			Resource... extendedResources); private  ResourceSpec(); ResourceSpec merge(ResourceSpec other); double getCpuCores(); int getHeapMemory(); int getDirectMemory(); int getNativeMemory(); int getStateSize(); int getManagedMemory(); double getGPUResource(); Map<String, Resource> getExtendedResources(); boolean isValid(); boolean lessThanOrEqual(@Nonnull ResourceSpec other); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static Builder newBuilder(); }
ResourceSpec implements Serializable { @Override public int hashCode() { final long cpuBits = Double.doubleToLongBits(cpuCores); int result = (int) (cpuBits ^ (cpuBits >>> 32)); result = 31 * result + heapMemoryInMB; result = 31 * result + directMemoryInMB; result = 31 * result + nativeMemoryInMB; result = 31 * result + stateSizeInMB; result = 31 * result + managedMemoryInMB; result = 31 * result + extendedResources.hashCode(); return result; } private  ResourceSpec(
			double cpuCores,
			int heapMemoryInMB,
			int directMemoryInMB,
			int nativeMemoryInMB,
			int stateSizeInMB,
			int managedMemoryInMB,
			Resource... extendedResources); private  ResourceSpec(); ResourceSpec merge(ResourceSpec other); double getCpuCores(); int getHeapMemory(); int getDirectMemory(); int getNativeMemory(); int getStateSize(); int getManagedMemory(); double getGPUResource(); Map<String, Resource> getExtendedResources(); boolean isValid(); boolean lessThanOrEqual(@Nonnull ResourceSpec other); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static Builder newBuilder(); static final ResourceSpec UNKNOWN; static final ResourceSpec DEFAULT; static final String GPU_NAME; }