List of usage examples for com.google.common.collect Iterables concat
public static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b)
From source file:org.grouplens.lenskit.eval.traintest.ExperimentSuite.java
public Iterable<Attributed> getAllAlgorithms() { return Iterables.concat(algorithms, externalAlgorithms); }
From source file:com.eucalyptus.reporting.dw.commands.StatusCommand.java
@Override protected void runCommand(final Arguments arguments) { final DatabaseConnectionInfo dbInfo = getDatabaseConnectionInfo(); long maxTime = Long.MIN_VALUE; long minTime = Long.MAX_VALUE; for (final Class<? extends ReportingEventSupport> entityClass : Iterables .concat(ExportUtils.getEventClasses(), ExportUtils.getUsageClasses())) { final EntityTransaction transaction = Entities.get(entityClass); try {/* w ww. j a v a 2 s. c o m*/ maxTime = Math.max(timestamp(entityClass, MAX, Long.MIN_VALUE), maxTime); minTime = Math.min(timestamp(entityClass, MIN, Long.MAX_VALUE), minTime); } finally { transaction.rollback(); } } System.out.println("Connected to database: " + dbInfo.getHost() + ":" + dbInfo.getPort() + "/" + dbInfo.getName() + " as " + dbInfo.getUser()); if (minTime == Long.MAX_VALUE) { System.out.println("No data found."); } else { System.out.println("Data present from " + format(minTime) + " to " + format(maxTime)); } }
From source file:de.johni0702.minecraft.gui.element.AbstractComposedGuiElement.java
@Override public int getMaxLayer() { return getLayer() + Ordering.natural().max(Iterables.concat(Collections.singleton(0), Iterables.transform(getChildren(), new Function<GuiElement, Integer>() { @Nullable// ww w .j av a 2 s. c o m @Override public Integer apply(GuiElement e) { return e instanceof ComposedGuiElement ? ((ComposedGuiElement) e).getMaxLayer() : e.getLayer(); } }))); }
From source file:org.gradle.internal.remote.internal.inet.MultiChoiceAddress.java
public MultiChoiceAddress addAddresses(Iterable<InetAddress> candidates) { return new MultiChoiceAddress(canonicalAddress, port, Lists.newArrayList(Iterables.concat(candidates, this.candidates))); }
From source file:org.sonar.java.model.expression.MethodReferenceTreeImpl.java
@Override public Iterable<Tree> children() { return Iterables.concat( typeArgument != null ? Collections.singletonList(typeArgument) : Collections.<Tree>emptyList(), Lists.newArrayList(expression, doubleColon, method)); }
From source file:org.sonar.scanner.report.ContextPropertiesPublisher.java
@Override public void publish(ScannerReportWriter writer) { MapEntryToContextPropertyFunction transformer = new MapEntryToContextPropertyFunction(); // properties defined programmatically by plugins Iterable<ScannerReport.ContextProperty> fromCache = from(cache.getAll().entrySet()).transform(transformer); // properties that are automatically included to report so that // they can be included to webhook payloads Iterable<ScannerReport.ContextProperty> fromSettings = from(settings.getProperties().entrySet()) .filter(e -> e.getKey().startsWith(ANALYSIS_PROPERTY_PREFIX)).transform(transformer); writer.writeContextProperties(Iterables.concat(fromCache, fromSettings)); }
From source file:fr.aliasource.webmail.common.folders.ListSubscribedFoldersCommand.java
public List<IFolder> getData() throws IOException, StoreException, InterruptedException { LinkedList<IFolder> l = new LinkedList<IFolder>(); ListResult infos = null;/* w w w . j a v a 2 s . c om*/ NameSpaceInfo namespaces = null; IStoreConnection con = account.getStoreProtocol(); try { infos = con.lsub("", "*"); namespaces = con.namespace(); } finally { con.destroy(); } if (infos != null && namespaces != null) { List<String> sharedNamespaces = Lists .newArrayList(Iterables.concat(namespaces.getOtherUsers(), namespaces.getMailShares())); for (ListInfo info : infos) { boolean shared = isShared(sharedNamespaces, info); l.add(new IMAPFolder(extractDisplayName(infos.getImapSeparator(), info), info.getName(), true, shared)); } } return l; }
From source file:org.sonar.java.model.statement.ExpressionStatementTreeImpl.java
@Override public Iterable<Tree> children() { return Iterables.concat(Collections.singletonList(expression), semicolonToken != null ? Collections.singletonList(semicolonToken) : Collections.<Tree>emptyList()); }
From source file:org.obiba.opal.web.datashield.RPackageResource.java
protected RScriptROperation getInstalledPackages(Iterable<String> fields) { Iterable<String> allFields = Iterables.concat(Arrays.asList(defaultFields), fields); String fieldStr = StringUtils.collectionToDelimitedString(Lists.newArrayList(allFields), ",", "'", "'"); String cmd = "installed.packages(fields=c(" + fieldStr + "))"; return execute(cmd); }
From source file:org.polarsys.reqcycle.utils.collect.IterableFactory.java
/** * Creates a depth wise iterable that concats all the iterables created by the call of createIterable on each of the starting elements. *//*from ww w .ja va 2s. c o m*/ public static <T> Iterable<T> createIterable(Iterable<T> startingElements, Picker<T> picker) { Iterable<T> result = Collections.emptyList(); for (T t : startingElements) { Iterable<T> tIterable = createIterable(t, Collections.singleton(picker)); result = Iterables.concat(result, tIterable); } return result; }