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.eclipse.sirius.ext.base.relations.UnionRelation.java

/**
 * Constructor./*from  www  . jav  a  2  s .c o  m*/
 * 
 * @param baseRelations
 *            the relations to consider in the union.
 */
public UnionRelation(Relation<T>... baseRelations) {
    this.baseRelations = ImmutableSet.copyOf(Iterators.forArray(Preconditions.checkNotNull(baseRelations)));
}

From source file:com.webbfontaine.valuewebb.irms.impl.bean.Calculator.java

private static boolean anyNull(BigDecimal... values) {
    return Iterators.any(Iterators.forArray(values), new EqualsNullPredicate());
}

From source file:org.sonar.db.dialect.DialectUtils.java

@CheckForNull
private static Dialect findDialect(Predicate<Dialect> predicate) {
    try {//from  w ww .  ja  v a2 s  .  co m
        return Iterators.find(Iterators.forArray(DIALECTS), predicate);
    } catch (NoSuchElementException ex) {
        return null;
    }
}

From source file:ec.nbdemetra.ui.awt.InputMaps.java

@Nonnull
private static Set<KeyStroke> asKeySet(final @Nonnull InputMap inputMap, final boolean includeParentKeys) {
    return new AbstractSet<KeyStroke>() {
        @Override//from w  w  w  .  ja  va2 s . c o  m
        public Iterator<KeyStroke> iterator() {
            KeyStroke[] keys = includeParentKeys ? inputMap.allKeys() : inputMap.keys();
            return keys != null ? Iterators.forArray(keys) : Iterators.<KeyStroke>emptyIterator();
        }

        @Override
        public int size() {
            int result = inputMap.size();
            if (includeParentKeys) {
                InputMap cursor = inputMap;
                while ((cursor = cursor.getParent()) != null) {
                    result += cursor.size();
                }
            }
            return result;
        }
    };
}

From source file:org.sonar.json.tree.impl.ValueTreeImpl.java

@Override
public Iterator<Tree> childrenIterator() {
    return Iterators.forArray(value);
}

From source file:uk.ac.ed.inf.ace.processors.Tokenizer.java

@Override
public ReadWriteableDocument process(ReadWriteableDocument document) {
    String content = (String) document.getContent();
    String[] tokens = pattern.split(content);
    document.setContent(Iterators.forArray(tokens));
    return document;
}

From source file:org.apache.drill.exec.physical.base.AbstractMultiple.java

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

From source file:com.webbfontaine.valuewebb.irms.impl.bean.Calculator.java

private static boolean anyZero(BigDecimal... values) {
    return Iterators.any(Iterators.forArray(values), new EqualsZeroPredicate());
}

From source file:org.sonar.json.tree.impl.KeyTreeImpl.java

@Override
public Iterator<Tree> childrenIterator() {
    return Iterators.forArray(key);
}

From source file:org.opendaylight.yangtools.binding.data.codec.gen.spi.AbstractSource.java

protected final CharSequence invoke(final CharSequence object, final String methodName, final Object... args) {
    StringBuilder builder = new StringBuilder();
    if (object != null) {
        builder.append(object);/*from  w ww .j  a  va2 s . c om*/
        builder.append('.');
    }
    builder.append(methodName);
    builder.append('(');

    UnmodifiableIterator<Object> iterator = Iterators.forArray(args);
    while (iterator.hasNext()) {
        builder.append(iterator.next());
        if (iterator.hasNext()) {
            builder.append(',');
        }
    }
    builder.append(')');
    return builder;
}