public final void foreach(final Consumer<Issue> sink) { CollectionUtil.foreach(new AbstractTransformIssueIterator<GenericValue>(issueGVs) { @Override protected Issue transform(final GenericValue o) { return issueFactory.getIssue(o); } }, sink); }
public void foreach(final Consumer<Issue> sink) { CollectionUtil.foreach(new AbstractTransformIssueIterator<Long>(ids) { @Override protected Issue transform(final Long o) { return issueManager.getIssueObject(o); } }, sink); }
public void close() { foreach(closeables, CLOSE); } }
public final void foreach(final Consumer<Issue> sink) { CollectionUtil.foreach(issueObjects, sink); }
/** * For each element in the iterator, consume the contents. * * @param <T> the element type * @param iterable to iterate over the elements, may be null * @param consumer to consume the elements */ public static <T> void foreach(final Iterable<T> iterable, @Nonnull final Consumer<T> consumer) { if (iterable != null) { foreach(iterable.iterator(), consumer); } }
public CompositeCloseable(final Collection<Closeable> closeables) { foreach(closeables, Sinks.<Closeable> nullChecker()); this.closeables = Collections.unmodifiableCollection(closeables); }
/** * Turn the iterator into a list. * * @param <T> the element type * @param iterator to iterate over the elements * @return an unmodifiable {@link List} of the elements in the iterator */ public static <T> List<T> toList(@Nonnull final Iterator<? extends T> iterator) { final List<T> result = new ArrayList<T>(); foreach(iterator, new Consumer<T>() { public void consume(final T element) { result.add(element); } }); return unmodifiableList(result); }
public static <T> void foreach(final CloseableIterator<T> iterator, final Consumer<T> consumer) { try { CollectionUtil.foreach(iterator, consumer); } finally { iterator.close(); } }
public void checkClusterNotActive(final ErrorCollection errors, final I18nHelper i18n) { if (clusterManager.isClustered()) { final Collection<Node> otherLiveNodes = new ArrayList<>(); final String thisNode = clusterManager.getNodeId(); if (thisNode != null) { final Collection<Node> liveNodes = clusterManager.findLiveNodes(); otherLiveNodes.addAll(liveNodes.stream().filter(liveNode -> !thisNode.equals(liveNode.getNodeId())).collect(Collectors.toList())); } if (!otherLiveNodes.isEmpty()) { final StringBuilder nodes = new StringBuilder(); foreach(otherLiveNodes, element -> { if (nodes.length() > 0) { nodes.append(", "); } nodes.append(element.getNodeId()); }); errors.addErrorMessage(i18n.getText("data.import.error.active.cluster1")); errors.addErrorMessage(i18n.getText("data.import.error.active.cluster2", thisNode, nodes.toString())); errors.addErrorMessage(i18n.getText("data.import.error.active.cluster3")); } } }
CollectionUtil.foreach(subscriptionManager.getAllFilterSubscriptions(searchRequest.getId()), subscription -> { try