Remove unnecessary boxing and unboxing
This commit is contained in:
parent
6c4502150e
commit
14fa1ef4b6
|
@ -74,7 +74,7 @@ public enum ReasonCode {
|
|||
}
|
||||
|
||||
public static ReasonCode fromInt(int i) {
|
||||
ReasonCode type = intToTypeMap.get(Integer.valueOf(i));
|
||||
ReasonCode type = intToTypeMap.get(i);
|
||||
if (type == null)
|
||||
return ReasonCode.UNKNOWN;
|
||||
return type;
|
||||
|
|
|
@ -79,7 +79,7 @@ public enum P2pMessageCodes {
|
|||
}
|
||||
|
||||
public static P2pMessageCodes fromByte(byte i) {
|
||||
P2pMessageCodes type = intToTypeMap.get(Integer.valueOf(i));
|
||||
P2pMessageCodes type = intToTypeMap.get((int) i);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ public class RLP {
|
|||
while (pos < endPos) {
|
||||
|
||||
if (level == levelToIndex)
|
||||
index.add(new Integer(pos));
|
||||
index.add(pos);
|
||||
|
||||
// It's a list with a payload more than 55 bytes
|
||||
// data[0] - 0xF7 = how many next bytes allocated
|
||||
|
@ -925,7 +925,7 @@ public class RLP {
|
|||
return (inputLong == 0) ? ByteUtil.EMPTY_BYTE_ARRAY : asUnsignedByteArray(BigInteger.valueOf(inputLong));
|
||||
} else if (input instanceof Integer) {
|
||||
Integer inputInt = (Integer) input;
|
||||
return (inputInt == 0) ? ByteUtil.EMPTY_BYTE_ARRAY : asUnsignedByteArray(BigInteger.valueOf(inputInt.intValue()));
|
||||
return (inputInt == 0) ? ByteUtil.EMPTY_BYTE_ARRAY : asUnsignedByteArray(BigInteger.valueOf(inputInt));
|
||||
} else if (input instanceof BigInteger) {
|
||||
BigInteger inputBigInt = (BigInteger) input;
|
||||
return (inputBigInt == BigInteger.ZERO) ? ByteUtil.EMPTY_BYTE_ARRAY : asUnsignedByteArray(inputBigInt);
|
||||
|
|
|
@ -614,7 +614,7 @@ public class RLPTest {
|
|||
|
||||
@Test
|
||||
public void testEncodeZero() {
|
||||
Integer test = new Integer(0);
|
||||
Integer test = 0;
|
||||
String expected = "80";
|
||||
byte[] encoderesult = RLP.encode(test);
|
||||
assertEquals(expected, Hex.toHexString(encoderesult));
|
||||
|
@ -625,7 +625,7 @@ public class RLPTest {
|
|||
|
||||
@Test
|
||||
public void testEncodeSmallInteger() {
|
||||
Integer test = new Integer(15);
|
||||
Integer test = 15;
|
||||
String expected = "0f";
|
||||
byte[] encoderesult = RLP.encode(test);
|
||||
assertEquals(expected, Hex.toHexString(encoderesult));
|
||||
|
@ -637,7 +637,7 @@ public class RLPTest {
|
|||
|
||||
@Test
|
||||
public void testEncodeMediumInteger() {
|
||||
Integer test = new Integer(1000);
|
||||
Integer test = 1000;
|
||||
String expected = "8203e8";
|
||||
byte[] encoderesult = RLP.encode(test);
|
||||
assertEquals(expected, Hex.toHexString(encoderesult));
|
||||
|
@ -646,7 +646,7 @@ public class RLPTest {
|
|||
int result = byteArrayToInt(decodeResult);
|
||||
assertEquals(test, Integer.valueOf(result));
|
||||
|
||||
test = new Integer(1024);
|
||||
test = 1024;
|
||||
expected = "820400";
|
||||
encoderesult = RLP.encode(test);
|
||||
assertEquals(expected, Hex.toHexString(encoderesult));
|
||||
|
|
Loading…
Reference in New Issue