/** * Turn the iterable into a list. * * @param <T> the element type * @param iterable to iterate over the elements * @return an unmodifiable {@link List} of the elements in the iterator */ public static <T> List<T> toList(@Nonnull final Iterable<? extends T> iterable) { return toList(iterable.iterator()); }
public CollectionBuilder<T> addAll(final Enumeration<? extends T> elements) { this.elements.addAll(toList(notNull("elements", elements))); return this; }
/** * Turn the enumeration into a list. * * @param <T> the element type * @param enumeration to enumerate over the elements * @return an unmodifiable {@link List} of the elements in the iterator */ public static <T> List<T> toList(@Nonnull final Enumeration<? extends T> enumeration) { return toList(fromEnumeration(enumeration)); }
/** * Return a List that is transformed from elements of the input type to elements of the output type by a transformer function. * * @param <T> the input type * @param <R> the out type * @param iterator to iterate over the contents * @param transformer the function that performs the transformation * @return an unmodifiable List of the transformed type */ public static <T, R> List<R> transform(@Nonnull final Iterator<? extends T> iterator, @Nonnull final Function<T, R> transformer) { return toList(transformIterator(iterator, transformer)); }
@Override @Nonnull public Collection<IssueSearcher<?>> getSearchersByClauseName(final ApplicationUser user, final String jqlClauseName) { notBlank("jqlClauseName", jqlClauseName); return toList(filter(transform(getHelper().getIssueSearcherRegistrationsByClauseName(jqlClauseName), new Function<SearcherRegistration, IssueSearcher<?>>() { @Override public IssueSearcher<?> get(final SearcherRegistration searcherRegistration) { return searcherRegistration.getIssueSearcher(); } }), Predicates.<IssueSearcher<?>>notNull())); }
@Override public Collection<IssueSearcher<?>> getSearchers(final ApplicationUser searcher, final SearchContext context) { notNull("context", context); context.verify(); return toList(filter(getAllSearchers(), new IsShown(searcher, context))); }
private Collection<TaskDescriptor<?>> findTasksInternal(final TaskMatcher matcher) { notNull("matcher", matcher); return toList(transform(filter(getTasks(taskMap), new TaskMatcherPredicate(matcher)), Functions.<TaskDescriptor<?>, TaskDescriptor<?>>coerceToSuper())); }