@Test public void testEmptyArray() { @SuppressWarnings("unchecked") DynamicArray<Uint> array = DynamicArray.empty("uint"); assertThat( TypeEncoder.encodeDynamicArray(array), is("0000000000000000000000000000000000000000000000000000000000000000") ); }
static <T extends Type> String encodeDynamicArray(DynamicArray<T> value) { int size = value.getValue().size(); String encodedLength = encode(new Uint(BigInteger.valueOf(size))); String encodedValues = encodeArrayValues(value); StringBuilder result = new StringBuilder(); result.append(encodedLength); result.append(encodedValues); return result.toString(); }
TypeEncoder { static <T extends Type> String encodeDynamicArray(DynamicArray<T> value) { int size = value.getValue().size(); String encodedLength = encode(new Uint(BigInteger.valueOf(size))); String encodedValues = encodeArrayValues(value); StringBuilder result = new StringBuilder(); result.append(encodedLength); result.append(encodedValues); return result.toString(); } }
TypeEncoder { static <T extends Type> String encodeDynamicArray(DynamicArray<T> value) { int size = value.getValue().size(); String encodedLength = encode(new Uint(BigInteger.valueOf(size))); String encodedValues = encodeArrayValues(value); StringBuilder result = new StringBuilder(); result.append(encodedLength); result.append(encodedValues); return result.toString(); } private  TypeEncoder(); }
TypeEncoder { static <T extends Type> String encodeDynamicArray(DynamicArray<T> value) { int size = value.getValue().size(); String encodedLength = encode(new Uint(BigInteger.valueOf(size))); String encodedValues = encodeArrayValues(value); StringBuilder result = new StringBuilder(); result.append(encodedLength); result.append(encodedValues); return result.toString(); } private  TypeEncoder(); @SuppressWarnings("unchecked") static String encode(Type parameter); }
TypeEncoder { static <T extends Type> String encodeDynamicArray(DynamicArray<T> value) { int size = value.getValue().size(); String encodedLength = encode(new Uint(BigInteger.valueOf(size))); String encodedValues = encodeArrayValues(value); StringBuilder result = new StringBuilder(); result.append(encodedLength); result.append(encodedValues); return result.toString(); } private  TypeEncoder(); @SuppressWarnings("unchecked") static String encode(Type parameter);  }