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

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

Introduction

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

Prototype

@Deprecated
public static <T> UnmodifiableIterator<T> emptyIterator() 

Source Link

Document

Returns the empty iterator.

Usage

From source file:org.eclipse.emf.compare.ide.ui.internal.logical.EmptyComparisonScope.java

/** {@inheritDoc} */
public Iterator<? extends EObject> getChildren(EObject eObject) {
    return Iterators.emptyIterator();
}

From source file:org.gradle.api.internal.changedetection.rules.PreviousSuccessTaskStateChanges.java

@Override
public Iterator<TaskStateChange> iterator() {
    if (previousExecution == null || previousExecution.isSuccessful()) {
        return Iterators.emptyIterator();
    } else {//w  w w  .jav  a  2  s.com
        return Iterators.singletonIterator(PREVIOUS_FAILURE);
    }
}

From source file:com.cognifide.cq.cqsm.foundation.actions.MockGroup.java

@Override
public Iterator<Group> declaredMemberOf() throws RepositoryException {
    return Iterators.emptyIterator();
}

From source file:edu.umd.cs.psl.ui.data.graph.Graph.java

public Iterator<Entity<ET, RT>> getEntities(ET type) {
    if (!entities.containsKey(type))
        return Iterators.emptyIterator();
    final Iterator<Entity<ET, RT>> iter = entities.get(type).values().iterator();
    return new Iterator<Entity<ET, RT>>() {

        Entity<ET, RT> current = null;

        @Override/*from w  w  w  .  j  a  v  a  2 s.c o  m*/
        public boolean hasNext() {
            return iter.hasNext();
        }

        @Override
        public Entity<ET, RT> next() {
            current = iter.next();
            return current;
        }

        @Override
        public void remove() {
            if (current.getDegree() > 0)
                throw new IllegalArgumentException("Cannot delete connected entity!");
            else
                iter.remove();
        }

    };
}

From source file:org.elasticsearch.search.aggregations.support.bytes.ScriptBytesValues.java

@Override
public int setDocument(int docId) {
    this.docId = docId;
    script.setNextDocId(docId);/* w  ww.j  av  a 2s . c  o  m*/
    value = script.run();

    if (value == null) {
        iter = Iterators.emptyIterator();
        return 0;
    }

    if (value.getClass().isArray()) {
        final int length = Array.getLength(value);
        // don't use Arrays.asList because the array may be an array of primitives?
        iter = new Iterator<Object>() {

            int i = 0;

            @Override
            public boolean hasNext() {
                return i < length;
            }

            @Override
            public Object next() {
                return Array.get(value, i++);
            }

            @Override
            public void remove() {
                throw new UnsupportedOperationException();
            }

        };
        return length;
    }

    if (value instanceof Collection) {
        final Collection<?> coll = (Collection<?>) value;
        iter = coll.iterator();
        return coll.size();
    }

    iter = Iterators.singletonIterator(value);
    return 1;
}

From source file:eu.numberfour.n4js.ui.internal.EclipseSourceContainer.java

@Override
public Iterator<URI> iterator() {
    if (exists()) {
        return super.iterator();
    } else {//from www. j  av  a 2 s  .c o m
        return Iterators.emptyIterator();
    }
}

From source file:org.geotools.data.versioning.decorator.ResourceIdFeatureCollector.java

@Override
public Iterator<Feature> iterator() {

    Iterator<Ref> featureRefs = Iterators.emptyIterator();

    GeoGIT ggit = new GeoGIT(repository);
    VersionQuery query = new VersionQuery(ggit, featureType.getName());
    try {//from   w w w . j  a  va2s.  com
        for (ResourceId rid : resourceIds) {
            Iterator<Ref> ridIterator;
            ridIterator = query.get(rid);
            featureRefs = Iterators.concat(featureRefs, ridIterator);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    Iterator<Feature> features = Iterators.transform(featureRefs, new RefToFeature(repository, featureType));

    return features;
}

From source file:net.sourceforge.docfetcher.util.collect.LazyList.java

@NotNull
public Iterator<T> iterator() {
    if (list == null)
        return Iterators.emptyIterator();
    return list.iterator();
}

From source file:com.cognifide.cq.cqsm.foundation.actions.MockGroup.java

@Override
public Iterator<Group> memberOf() throws RepositoryException {
    return Iterators.emptyIterator();
}

From source file:com.stottlerhenke.versionspaces.examples.RatioVS.java

@Override
public UnmodifiableIterator<ConfidentHypothesis<Double, Double>> hypotheses() {

    if (null == _ratio) {
        return Iterators.emptyIterator();
    }/* ww w  .j  a v  a2  s. co  m*/

    final Double value = _ratio;
    return Iterators
            .singletonIterator(new ConfidentHypothesis<Double, Double>(new Hypothesis<Double, Double>() {
                @Override
                public Double eval(final Double in) {
                    return in * value;
                }
            }, 1.0));
}