@Test public void testTypeMapEmpty() { MatcherAssert.assertThat(Utils.typeMap(new ArrayList<BigInteger>(), Uint256.class), equalTo(new ArrayList<Uint256>())); }
public static <T, R extends Type<T>> List<R> typeMap(List<T> input, Class<R> destType) throws TypeMappingException { List<R> result = new ArrayList<R>(input.size()); if (!input.isEmpty()) { try { Constructor<R> constructor = destType.getDeclaredConstructor( input.get(0).getClass()); for (T value : input) { result.add(constructor.newInstance(value)); } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { throw new TypeMappingException(e); } } return result; }
Utils { public static <T, R extends Type<T>> List<R> typeMap(List<T> input, Class<R> destType) throws TypeMappingException { List<R> result = new ArrayList<R>(input.size()); if (!input.isEmpty()) { try { Constructor<R> constructor = destType.getDeclaredConstructor( input.get(0).getClass()); for (T value : input) { result.add(constructor.newInstance(value)); } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { throw new TypeMappingException(e); } } return result; } }
Utils { public static <T, R extends Type<T>> List<R> typeMap(List<T> input, Class<R> destType) throws TypeMappingException { List<R> result = new ArrayList<R>(input.size()); if (!input.isEmpty()) { try { Constructor<R> constructor = destType.getDeclaredConstructor( input.get(0).getClass()); for (T value : input) { result.add(constructor.newInstance(value)); } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { throw new TypeMappingException(e); } } return result; } private  Utils(); }
Utils { public static <T, R extends Type<T>> List<R> typeMap(List<T> input, Class<R> destType) throws TypeMappingException { List<R> result = new ArrayList<R>(input.size()); if (!input.isEmpty()) { try { Constructor<R> constructor = destType.getDeclaredConstructor( input.get(0).getClass()); for (T value : input) { result.add(constructor.newInstance(value)); } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { throw new TypeMappingException(e); } } return result; } private  Utils(); @SuppressWarnings("unchecked") static List<TypeReference<Type>> convert(List<TypeReference<?>> input); static List<R> typeMap(List<T> input, Class<R> destType); }
Utils { public static <T, R extends Type<T>> List<R> typeMap(List<T> input, Class<R> destType) throws TypeMappingException { List<R> result = new ArrayList<R>(input.size()); if (!input.isEmpty()) { try { Constructor<R> constructor = destType.getDeclaredConstructor( input.get(0).getClass()); for (T value : input) { result.add(constructor.newInstance(value)); } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) { throw new TypeMappingException(e); } } return result; } private  Utils(); @SuppressWarnings("unchecked") static List<TypeReference<Type>> convert(List<TypeReference<?>> input); static List<R> typeMap(List<T> input, Class<R> destType);  }