Example usage for org.apache.commons.functor NullaryFunction evaluate

List of usage examples for org.apache.commons.functor NullaryFunction evaluate

Introduction

In this page you can find the example usage for org.apache.commons.functor NullaryFunction evaluate.

Prototype

T evaluate();

Source Link

Document

Evaluate this function.

Usage

From source file:org.apache.commons.functor.example.kata.two.EiffelStyleLoop.java

@SuppressWarnings("unchecked")
public EiffelStyleLoop variant(final NullaryFunction<Object> function) {
    return variant(new NullaryPredicate() {
        public boolean test() {
            boolean result = true;
            Comparable<Object> next = (Comparable<Object>) (function.evaluate());
            if (null != last) {
                result = last.compareTo(next) > 0;
            }//from  w w  w .  j  ava 2s .  c  o m
            last = next;
            return result;
        }

        private Comparable<Object> last = null;
    });
}