All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.anteros.bean.validation.constraints.validators.TimeAction Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package br.com.anteros.bean.validation.constraints.validators;

import java.util.function.Function;
import java.util.function.Supplier;

public class TimeAction {

    public static  TimeActionResponse recordTimeAndDo(Function function, Input val) {
        long t1 = System.currentTimeMillis();
        Ret result = function.apply(val);
        long t2 = System.currentTimeMillis() - t1;
        return new TimeActionResponse<>(result, t2);
    }

    public static  TimeActionResponse recordTimeAndDo(Supplier supplier) {
        long t1 =System.currentTimeMillis();
        Ret result = supplier.get();
        long t2 = System.currentTimeMillis() - t1;
        return new TimeActionResponse<>(result, t2);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy