@Test void testReuseConstants() { List<Wei> oneTime = new ArrayList<>(); for (int i = 0; i < 128; i++) { oneTime.add(Wei.valueOf((long) i)); } List<Wei> secondTime = new ArrayList<>(); for (int i = 0; i < 128; i++) { secondTime.add(Wei.valueOf((long) i)); } for (int i = 0; i < 128; i++) { Wei first = oneTime.get(i); Wei second = secondTime.get(i); if (i <= 64) { assertSame(first, second); } else { assertNotSame(first, second); assertEquals(first, second); } } }
public static Wei valueOf(UInt256 value) { if (value.compareTo(UINT256_MAX_CONSTANT) <= 0) { return CONSTANTS[value.intValue()]; } return new Wei(value); }
Wei extends BaseUInt256Value<Wei> { public static Wei valueOf(UInt256 value) { if (value.compareTo(UINT256_MAX_CONSTANT) <= 0) { return CONSTANTS[value.intValue()]; } return new Wei(value); } }
Wei extends BaseUInt256Value<Wei> { public static Wei valueOf(UInt256 value) { if (value.compareTo(UINT256_MAX_CONSTANT) <= 0) { return CONSTANTS[value.intValue()]; } return new Wei(value); } private  Wei(UInt256 bytes); private  Wei(long value); private  Wei(BigInteger value); }
Wei extends BaseUInt256Value<Wei> { public static Wei valueOf(UInt256 value) { if (value.compareTo(UINT256_MAX_CONSTANT) <= 0) { return CONSTANTS[value.intValue()]; } return new Wei(value); } private  Wei(UInt256 bytes); private  Wei(long value); private  Wei(BigInteger value); static Wei valueOf(UInt256 value); static Wei valueOf(long value); static Wei valueOf(BigInteger value); }
Wei extends BaseUInt256Value<Wei> { public static Wei valueOf(UInt256 value) { if (value.compareTo(UINT256_MAX_CONSTANT) <= 0) { return CONSTANTS[value.intValue()]; } return new Wei(value); } private  Wei(UInt256 bytes); private  Wei(long value); private  Wei(BigInteger value); static Wei valueOf(UInt256 value); static Wei valueOf(long value); static Wei valueOf(BigInteger value);  }