List of usage examples for com.google.common.collect Iterables unmodifiableIterable
@Deprecated public static <E> Iterable<E> unmodifiableIterable(ImmutableCollection<E> iterable)
From source file:ninja.leaping.permissionsex.backend.memory.MemoryDataStore.java
@Override public Iterable<Map.Entry<Map.Entry<String, String>, ImmutableSubjectData>> getAll() { return Iterables.unmodifiableIterable(data.entrySet()); }
From source file:com.googlecode.blaisemath.graphics.core.GraphicComposite.java
/** * Get graphic entries in the order they are drawn. * @return iterator over the entries, in draw order *///from w ww. j a v a 2s . c om public Iterable<Graphic<G>> getGraphics() { return Iterables.unmodifiableIterable(entries); }
From source file:org.ow2.mind.plugin.BasicPluginManager.java
public Iterable<String> getExtensionPointNames() { return Iterables.unmodifiableIterable(getRegistry().extensionPoints.keySet()); }
From source file:org.apache.druid.query.groupby.epinephelinae.GroupByMergingQueryRunnerV2.java
public GroupByMergingQueryRunnerV2(GroupByQueryConfig config, ExecutorService exec, QueryWatcher queryWatcher, Iterable<QueryRunner<Row>> queryables, int concurrencyHint, BlockingPool<ByteBuffer> mergeBufferPool, int mergeBufferSize, ObjectMapper spillMapper, String processingTmpDir) { this.config = config; this.exec = MoreExecutors.listeningDecorator(exec); this.queryWatcher = queryWatcher; this.queryables = Iterables.unmodifiableIterable(Iterables.filter(queryables, Predicates.notNull())); this.concurrencyHint = concurrencyHint; this.mergeBufferPool = mergeBufferPool; this.spillMapper = spillMapper; this.processingTmpDir = processingTmpDir; this.mergeBufferSize = mergeBufferSize; }
From source file:org.bootenv.EnvironmentImpl.java
@Override public Iterable<String> getKeys() { LOG.debug("Getting Environment keys..."); try {// ww w . ja v a 2 s .c o m Optional<Map<String, String>> properties = fromNullable(System.getenv()); if (properties.isPresent()) { Set<String> keys = properties.get().keySet(); if (!keys.isEmpty()) { return Iterables.unmodifiableIterable(keys); } } } catch (Exception ex) { LOG.error("Error getting ENV properties!", ex); } LOG.debug("Environment has no properties..."); return Collections.emptyList(); }
From source file:com.facebook.buck.core.util.graph.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}./*w w w .ja v a 2 s .c o m*/ * @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 { // This corresponds to the current chain of nodes being explored. Enforcing this invariant makes // this data structure useful for debugging. Deque<Explorable> toExplore = new LinkedList<>(); for (T node : initialNodes) { toExplore.add(new Explorable(node)); } Set<T> inProgress = new HashSet<>(); LinkedHashSet<T> explored = new LinkedHashSet<>(); while (!toExplore.isEmpty()) { Explorable explorable = toExplore.peek(); T node = explorable.node; // This could happen if one of the initial nodes is a dependency of the other, for example. if (explored.contains(node)) { toExplore.removeFirst(); continue; } inProgress.add(node); // Find children that need to be explored to add to the stack. int stackSize = toExplore.size(); if (shouldExploreChildren.test(node)) { for (Iterator<T> iter = explorable.children; iter.hasNext();) { T child = iter.next(); if (inProgress.contains(child)) { throw createCycleException(child, toExplore); } else if (!explored.contains(child)) { toExplore.addFirst(new Explorable(child)); // Without this break statement: // (1) Children will be explored in reverse order instead of the specified order. // (2) CycleException may contain extra nodes. // Comment out the break statement and run the unit test to verify this for yourself. break; } } } if (stackSize == toExplore.size()) { // Nothing was added to toExplore, so the current node can be popped off the stack and // marked as explored. toExplore.removeFirst(); inProgress.remove(node); explored.add(node); } } Preconditions.checkState(inProgress.isEmpty(), "No more nodes should be in progress."); return Iterables.unmodifiableIterable(explored); }
From source file:org.eclipse.xtext.formatting2.internal.ArrayListTextSegmentSet.java
@Override public Iterator<T> iterator() { return Iterables.unmodifiableIterable(contents).iterator(); }
From source file:mx.bigdata.jcalais.rest.CalaisRestClient.java
public static CalaisResponse processResponse(Map<String, Object> map, final String payload) { Map<String, Object> doc = (Map<String, Object>) map.remove("doc"); final CalaisObject info = extractObject(doc, "info"); final CalaisObject meta = extractObject(doc, "meta"); Multimap<String, CalaisObject> hierarchy = createHierarchy(map); final Iterable<CalaisObject> topics = Iterables.unmodifiableIterable(hierarchy.get("topics")); final Iterable<CalaisObject> entities = Iterables.unmodifiableIterable(hierarchy.get("entities")); final Iterable<CalaisObject> relations = Iterables.unmodifiableIterable(hierarchy.get("relations")); final Iterable<CalaisObject> socialTags = Iterables.unmodifiableIterable(hierarchy.get("socialTag")); return new CalaisResponse() { public CalaisObject getInfo() { return info; }/* w w w .jav a 2 s . c om*/ public CalaisObject getMeta() { return meta; } public Iterable<CalaisObject> getTopics() { return topics; } public Iterable<CalaisObject> getEntities() { return entities; } public Iterable<CalaisObject> getRelations() { return relations; } public Iterable<CalaisObject> getSocialTags() { return socialTags; } public String getPayload() { return payload; } }; }
From source file:org.ow2.mind.plugin.ExtensionPointImpl.java
public Iterable<Extension> getExtensions() { return Iterables.unmodifiableIterable(extensions); }
From source file:org.ow2.mind.plugin.ExtensionPointImpl.java
public Iterable<ConfigurationElement> getConfigurationElements() { return Iterables.unmodifiableIterable(Iterables .concat(Iterables.transform(extensions, new Function<Extension, Iterable<ConfigurationElement>>() { public Iterable<ConfigurationElement> apply(final Extension from) { return from.getConfigurationElements(); }//w ww . jav a2s.c o m }))); }