Example usage for com.google.common.base Functions forPredicate

List of usage examples for com.google.common.base Functions forPredicate

Introduction

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

Prototype

public static <T> Function<T, Boolean> forPredicate(Predicate<T> predicate) 

Source Link

Document

Creates a function that returns the same boolean output as the given predicate for all inputs.

Usage

From source file:com.eucalyptus.entities.Entities.java

public static <E, T> Predicate<T> asTransaction(final Class<E> type, final Predicate<T> predicate,
        final Integer retries) {
    final Function<T, Boolean> funcionalized = Functions.forPredicate(predicate);
    final Function<T, Boolean> transactionalized = Entities.asTransaction(type, funcionalized, retries);
    return new Predicate<T>() {

        @Override//from w  w w.j  a  v a  2s .  co m
        public boolean apply(T input) {
            return transactionalized.apply(input);
        }

    };
}