com.google.common.collect.Iterables#unmodifiableIterable ( )源码实例Demo

下面列出了com.google.common.collect.Iterables#unmodifiableIterable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: attic-aurora   文件: HostOffers.java
/**
 * Returns a weakly-consistent iterable giving the available offers to a given
 * {@code groupKey}. This iterable can handle concurrent operations on its underlying
 * collection, and may reflect changes that happen after the construction of the iterable.
 * This property is mainly used in {@code launchTask}.
 *
 * @param groupKey The task group to get offers for.
 * @return The offers a given task group can use.
 */
synchronized Iterable<HostOffer> getAllMatching(TaskGroupKey groupKey,
                                                ResourceRequest resourceRequest) {

  return Iterables.unmodifiableIterable(
      FluentIterable.from(offers.getOrdered(groupKey, resourceRequest))
          .filter(o -> !isGloballyBanned(o))
          .filter(o -> !isStaticallyBanned(o, groupKey))
          .filter(HostOffer::hasCpuAndMem)
          .filter(o -> !isVetoed(o, resourceRequest, Optional.of(groupKey))));
}
 
@Test(expected = UnsupportedOperationException.class)
public final void givenUnmodifiableViewOverIterable_whenTryingToRemove_thenNotAllowed() {
    final List<Integer> numbers = Lists.newArrayList(1, 2, 3);
    final Iterable<Integer> unmodifiableIterable = Iterables.unmodifiableIterable(numbers);
    final Iterator<Integer> iterator = unmodifiableIterable.iterator();
    if (iterator.hasNext()) {
        iterator.remove();
    }
}
 
源代码3 项目: alchemy   文件: Experiments.java
/**
 * Finds an experiment given a set of criteria
 */
public Iterable<Experiment> find(Filter filter) {
    return Iterables.unmodifiableIterable(
        new CacheStrategyIterable(
            store.find(filter, new Experiment.BuilderFactory(this)),
            context,
            strategy
        )
    );
}
 
源代码4 项目: PGM   文件: MatchManagerImpl.java
@Override
public Iterable<? extends Audience> getAudiences() {
  return Iterables.unmodifiableIterable(matchById.values());
}
 
源代码5 项目: powsybl-core   文件: BusBreakerVoltageLevel.java
@Override
public Iterable<Bus> getBuses() {
    return Iterables.unmodifiableIterable(Iterables.transform(graph.getVerticesObj(), Functions.identity()));
}
 
源代码6 项目: powsybl-core   文件: BusBreakerVoltageLevel.java
@Override
public Iterable<Switch> getSwitches() {
    return Iterables.unmodifiableIterable(Iterables.transform(graph.getEdgesObject(), Functions.identity()));
}
 
源代码7 项目: dremio-oss   文件: MaterializationCache.java
Iterable<MaterializationDescriptor> getAll() {
  return Iterables.unmodifiableIterable(cached.get().values());
}
 
源代码8 项目: dremio-oss   文件: SingletonRegistry.java
protected Iterable<Service> getServices() {
  return Iterables.unmodifiableIterable(registry.getServices());
}
 
public Iterable<Exception> getExceptions() {
	return Iterables.unmodifiableIterable(exceptions);
}
 
源代码10 项目: putnami-web-toolkit   文件: AbstractInput.java
@Override
public Iterable<Error> getErrors() {
	return this.errors == null ? Collections.<Error> emptyList() : Iterables.unmodifiableIterable(this.errors);
}
 
源代码11 项目: kieker   文件: GraphImpl.java
@Override
public Iterable<IVertex> getVertices() {
	return Iterables.unmodifiableIterable(this.vertices.values());
}
 
源代码12 项目: putnami-web-toolkit   文件: TableEditorTH.java
@Override
public Iterable<Editor> getEditors() {
	return Iterables.unmodifiableIterable((Collection) this.aspects);
}
 
源代码13 项目: astor   文件: XtbMessageBundle.java
@Override
public Iterable<JsMessage> getAllMessages() {
  return Iterables.unmodifiableIterable(messages.values());
}
 
源代码14 项目: alchemy   文件: Experiments.java
/**
 * Returns all active experiments
 */
public Iterable<Experiment> getActiveExperiments() {
    strategy.onCacheRead(context);
    return Iterables.unmodifiableIterable(cache.getActiveExperiments().values());
}
 
源代码15 项目: alchemy   文件: Experiments.java
/**
 * Finds all experiments
 */
public Iterable<Experiment> find() {
    return Iterables.unmodifiableIterable(
        find(Filter.criteria().build())
    );
}
 
源代码16 项目: bgpcep   文件: SimpleNlriRegistry.java
@Override
public Iterable<NlriSerializer> getSerializers() {
    return Iterables.unmodifiableIterable(this.serializers.values());
}
 
源代码17 项目: putnami-web-toolkit   文件: ModelDriver.java
@Override
public Iterable<Error> getErrors() {
	return this.errors == null ? Collections.<Error> emptyList() : Iterables.unmodifiableIterable(this.errors);
}
 
源代码18 项目: buck   文件: AcyclicDepthFirstPostOrderTraversal.java
/**
 * Performs a depth-first, post-order traversal over a DAG.
 *
 * @param initialNodes The nodes from which to perform the traversal. Not allowed to contain
 *     {@code null}.
 * @param shouldExploreChildren Whether or not to explore a particular node's children. Used to
 *     support short circuiting in the traversal.
 * @throws CycleException if a cycle is found while performing the traversal.
 */
@SuppressWarnings("PMD.PrematureDeclaration")
public Iterable<T> traverse(
    Iterable<? extends T> initialNodes, Predicate<T> shouldExploreChildren)
    throws CycleException {
  return Iterables.unmodifiableIterable(
      traversal.traverse(initialNodes, shouldExploreChildren).keySet());
}
 
/**
 * Performs a depth-first, post-order traversal over a DAG.
 *
 * @param initialNodes The nodes from which to perform the traversal. Not allowed to contain
 *     {@code null}.
 * @param shouldExploreChildren Whether or not to explore a particular node's children. Used to
 *     support short circuiting in the traversal.
 * @throws CycleException if a cycle is found while performing the traversal.
 */
@SuppressWarnings("PMD.PrematureDeclaration")
public Iterable<T> traverse(
    Iterable<? extends T> initialNodes, Predicate<T> shouldExploreChildren)
    throws CycleException {
  return Iterables.unmodifiableIterable(
      traversal.traverse(initialNodes, shouldExploreChildren).keySet());
}
 
源代码20 项目: putnami-web-toolkit   文件: Theme.java
/**
 * Gets the links of the Theme. the links are wrapped in an unmodifiable Iterable.
 *
 * @return the links
 */
public Iterable<CssLink> getLinks() {
	return Iterables.unmodifiableIterable(this.links);
}