List of usage examples for org.apache.commons.collections4 IteratorUtils arrayIterator
public static <E> ResettableIterator<E> arrayIterator(final Object array)
From source file:com.github.rvesse.airline.utils.AirlineUtils.java
public static <T> List<T> arrayToList(T[] array) { return IteratorUtils.toList(IteratorUtils.arrayIterator(array)); }
From source file:com.link_intersystems.lang.reflect.TypeVariableToStringTransformer.java
public String transform(TypeVariable<?> typeVariable) { String genericTypeName = typeVariable.getName(); StringBuilder toStringBuilder = new StringBuilder(genericTypeName); Type[] boundsArr = typeVariable.getBounds(); if (boundsArr.length != 1 || !Object.class.equals(boundsArr[0])) { toStringBuilder.append(" extends "); Iterator<Type> boundsIterator = IteratorUtils.arrayIterator(boundsArr); while (boundsIterator.hasNext()) { Type boundsType = boundsIterator.next(); if (boundsType instanceof Class<?>) { Class<?> classObj = Class.class.cast(boundsType); String classToString = classToString(classObj); toStringBuilder.append(classToString); } else if (boundsType instanceof TypeVariable<?>) { TypeVariable<?> boundsTypeVariable = (TypeVariable<?>) boundsType; String typeVariableAsString = typeVariableToString(boundsTypeVariable); toStringBuilder.append(typeVariableAsString); } else if (boundsType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) boundsType; String string = parameterizedTypeToString(parameterizedType); toStringBuilder.append(string); } else { toStringBuilder.append("???"); }/* w w w.ja v a 2s.co m*/ if (boundsIterator.hasNext()) { toStringBuilder.append(" & "); } } } return toStringBuilder.toString(); }
From source file:com.github.rvesse.airline.builder.CliBuilder.java
@SuppressWarnings("unchecked") public CliBuilder<C> withCommands(Class<? extends C> command, Class<? extends C>... moreCommands) { this.defaultCommandGroupCommands.add(command); this.defaultCommandGroupCommands.addAll( ListUtils.unmodifiableList(IteratorUtils.toList(IteratorUtils.arrayIterator(moreCommands)))); return this; }