Example usage for com.google.common.collect Iterators forArray

List of usage examples for com.google.common.collect Iterators forArray

Introduction

In this page you can find the example usage for com.google.common.collect Iterators forArray.

Prototype

public static <T> UnmodifiableIterator<T> forArray(final T... array) 

Source Link

Document

Returns an iterator containing the elements of array in order.

Usage

From source file:org.glowroot.plugin.jdbc.message.BindParameterList.java

@Override
public Iterator</*@Nullable*/Object> iterator() {
    return Iterators.limit(Iterators.forArray(parameters), size);
}

From source file:org.glowroot.agent.plugin.jdbc.message.BindParameterList.java

@Override
public Iterator</*@Nullable*/ Object> iterator() {
    return Iterators.limit(Iterators.forArray(parameters), size);
}

From source file:io.github.holasylk.collect.guava.LinkedNode.java

@Override
public Iterator<T> iterator() {
    //noinspection unchecked
    return (Iterator<T>) Iterators.forArray(toArray());
}

From source file:org.elasticsearch.action.terms.FieldTermsFreq.java

@Override
public Iterator<TermFreq> iterator() {
    return Iterators.forArray(termsFreqs);
}

From source file:com.clearclouds.driver.monitor.fs.FsInfo.java

@Override
public Iterator<Path> iterator() {
    return Iterators.forArray(paths);
}

From source file:org.elasticsearch.action.terms.TermsResponse.java

/**
 * Iterates over the {@link FieldTermsFreq}.
 */
@Override
public Iterator<FieldTermsFreq> iterator() {
    return Iterators.forArray(fieldsTermsFreq);
}

From source file:com.diio.query.matcher.ListOfNodeMatcher.java

@Override
protected boolean matchesSafely(QueryTreeNode item) {
    if (item instanceof QueryTreeNodeList) {
        @SuppressWarnings("unchecked")
        UnmodifiableIterator<Matcher<QueryTreeNode>> matcherIterator = Iterators.forArray(submatchers);

        if (!matcherIterator.hasNext()) {
            //degenerate case -- no specified submatcher matches everything
            return true;
        }//from  w w w.ja va  2  s .com
        Matcher<QueryTreeNode> nextMatcher = matcherIterator.next();

        @SuppressWarnings("unchecked")
        final Iterator<QueryTreeNode> nodeListIterator = ((QueryTreeNodeList<QueryTreeNode>) item).iterator();

        QueryTreeNode nextNode;

        while (nodeListIterator.hasNext()) {
            nextNode = nodeListIterator.next();
            if (QueryHasMatcher.hasInQuery(nextMatcher).matches(nextNode)) {
                if (matcherIterator.hasNext()) {
                    nextMatcher = matcherIterator.next();
                } else {
                    return (matchType != MatchType.EXACT_SEQUENCE) || !nodeListIterator.hasNext();
                }
            } else if (matchType == MatchType.EXACT_SEQUENCE) {
                return false;
            } else if (matchType == MatchType.SUBSEQUENCE_NO_GAPS) {
                @SuppressWarnings("unchecked")
                UnmodifiableIterator<Matcher<QueryTreeNode>> newMatcherIterator = Iterators
                        .forArray(submatchers);

                //on the next iteration, pretend we haven't matched anything yet, even if we have
                matcherIterator = newMatcherIterator;

                nextMatcher = matcherIterator.next();
            }
        }
    }
    return false;
}

From source file:com.linecorp.armeria.common.logging.RequestLogAvailabilitySet.java

@Override
public Iterator<RequestLogAvailability> iterator() {
    return Iterators.forArray(values);
}

From source file:org.matsim.contrib.dvrp.router.VrpPathImpl.java

@Override
public Iterator<Link> iterator() {
    return Iterators.forArray(links);
}

From source file:kihira.minicreatures.common.entity.ai.EntityAIIdleEntityChat.java

@Override
public void startExecuting() {
    //Look for some valid chat lines to say about this entity
    String entityName = this.target instanceof EntityPlayer ? "Player"
            : EntityList.getEntityString(this.target);

    //Look for some valid chat lines to say about this block
    if (entityName != null) {
        for (int i = 0; i < 10; i++) {
            String chatLine = "chat.idle.entity." + this.miniPlayer.getPersonality().getCurrentMood().name + "."
                    + entityName + "." + i;
            if (StatCollector.canTranslate(chatLine)) {
                this.chatLines = Iterators.forArray(StatCollector.translateToLocal(chatLine).split(";"));
                break;
            }//from  ww w . ja  v a2  s . com
        }
    }
    //If we can't find anything, load default chat if there is a chance too
    if (this.chatLines == null && this.miniPlayer.getRNG().nextInt(30) == 0) {
        for (int i = 0; i < 10; i++) {
            String chatLine = "chat.idle.entity.generic."
                    + this.miniPlayer.getPersonality().getCurrentMood().name + "." + i;
            if (StatCollector.canTranslate(chatLine)) {
                this.chatLines = Iterators.forArray(StatCollector.translateToLocal(chatLine).split(";"));
                break;
            }
        }
    }
}