Example usage for com.google.common.base Supplier Supplier

List of usage examples for com.google.common.base Supplier Supplier

Introduction

In this page you can find the example usage for com.google.common.base Supplier Supplier.

Prototype

Supplier

Source Link

Usage

From source file:org.jetbrains.jet.codegen.StdlibTestForever.java

public static void main(String[] args) {
    TestForeverRunner.runTestForever(args, new Supplier<Test>() {
        @Override//from w  w  w .  ja v  a 2  s.  c o m
        public Test get() {
            return new TestSuite(StdlibTest.class);
        }
    });
}

From source file:org.robotframework.ide.eclipse.main.plugin.tableeditor.source.assist.Assistant.java

static SuiteSourceAssistantContext createAssistant(final RobotSuiteFile model) {
    return new SuiteSourceAssistantContext(new Supplier<RobotSuiteFile>() {

        @Override/*from www .j a va2  s .c  o  m*/
        public RobotSuiteFile get() {
            model.parse();
            return model;
        }
    }, new AssistPreferences(new MockRedPreferences(false, "  ")));
}

From source file:see.reactive.Signals.java

public static <T> Supplier<T> signalSupplier(final Signal<T> signal) {
    return new Supplier<T>() {
        @Override// w w w  .  ja v a 2  s  .com
        public T get() {
            return signal.now();
        }
    };
}

From source file:org.rulesdsl.rules.Utils.java

public static <T> Supplier<T> asSupplier(final Callable<T> callable) {
    return new Supplier<T>() {
        public T get() {
            try {
                return callable.call();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }/*www  . j  a v a2s .  com*/
        }
    };
}

From source file:edu.byu.nlp.util.Suppliers.java

public static <E> Supplier<ArrayList<E>> arrayListFactory() {
    return new Supplier<ArrayList<E>>() {

        @Override//from w w  w  .  j  av a 2 s .com
        public ArrayList<E> get() {
            return Lists.newArrayList();
        }
    };
}

From source file:see.util.Suppliers.java

/**
 * Create supplier for {@link AtomicReference}
 * @param reference source reference//from www  .java2  s . c o m
 * @param <T> value type
 * @return created supplier
 */
public static <T> Supplier<T> fromAtomicReference(final AtomicReference<T> reference) {
    return new Supplier<T>() {
        @Override
        public T get() {
            return reference.get();
        }
    };
}

From source file:org.apache.druid.common.guava.DSuppliers.java

public static <T> Supplier<T> of(final AtomicReference<T> ref) {
    return new Supplier<T>() {
        @Override//from  w  w  w  .j av  a2  s .  co m
        public T get() {
            return ref.get();
        }
    };
}

From source file:com.ibm.og.supplier.Suppliers.java

/**
 * Creates a supplier that always returns the same value
 * /*from w  ww . j av  a  2 s  .c o  m*/
 * @param value the value to supply
 * @return a supply which always returns the same value
 * @throws NullPointerException if value is null
 */
public static <T> Supplier<T> of(final T value) {
    checkNotNull(value);
    return new Supplier<T>() {
        @Override
        public T get() {
            return value;
        }

        @Override
        public String toString() {
            return value.toString();
        }
    };
}

From source file:net.sourceforge.cilib.util.RandomProviders.java

public static Supplier<Number> supplierOf(final RandomProvider randomProvider) {
    return new Supplier<Number>() {

        @Override//from   ww  w.ja  va 2s  . co m
        public Number get() {
            return randomProvider.nextDouble();
        }
    };
}

From source file:edu.uci.ics.jung.graph.UndirectedOrderedSparseMultigraph.java

/**
 * @param <V> the vertex type for the graph Supplier
 * @param <E> the edge type for the graph Supplier
 * @return a {@code Supplier} that creates an instance of this graph type.
 *///from w ww . j  a v a2s. c o m
public static <V, E> Supplier<UndirectedGraph<V, E>> getFactory() {
    return new Supplier<UndirectedGraph<V, E>>() {
        public UndirectedGraph<V, E> get() {
            return new UndirectedOrderedSparseMultigraph<V, E>();
        }
    };
}