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

javaslang.match.Matchs Maven / Gradle / Ivy

There is a newer version: 2.0.0-RC4
Show newest version
/**    / \____  _    ______   _____ / \____   ____  _____
 *    /  \__  \/ \  / \__  \ /  __//  \__  \ /    \/ __  \   Javaslang
 *  _/  // _\  \  \/  / _\  \\_  \/  // _\  \  /\  \__/  /   Copyright 2014-2015 Daniel Dietrich
 * /___/ \_____/\____/\_____/____/\___\_____/_/  \_/____/    Licensed under the Apache License, Version 2.0
 */
package javaslang.match;

import java.util.function.*;

import javaslang.Functions.*;

/**
 * 

* Extension methods for {@link Match}. *

* This class is not intended to be extended. */ public final class Matchs { /** * This class is not intended to be instantiated. */ private Matchs() { throw new AssertionError(Matchs.class.getName() + " is not intended to be instantiated."); } /** * Shortcut for {@code new Match.Builder().caze(function)}. * * @param return type of the matcher function * @param function A function which is applied to a matched object. * @return A Match of type T */ public static Match.Builder caze(λ1 function) { return new Match.Builder().caze(function); } /** * Shortcut for {@code new Match.Builder().caze(prototype, function)}. * * @param type of the prototype object * @param return type of the matcher function * @param prototype An object which matches by equality. * @param function A function which is applied to a matched object. * @return A Match of type T */ public static Match.Builder caze(T prototype, λ1 function) { return new Match.Builder().caze(prototype, function); } public static Match.Builder caze(BooleanFunction function) { return new Match.Builder().caze(function); } public static Match.Builder caze(ByteFunction function) { return new Match.Builder().caze(function); } public static Match.Builder caze(CharFunction function) { return new Match.Builder().caze(function); } public static Match.Builder caze(DoubleFunction function) { return new Match.Builder().caze(function); } public static Match.Builder caze(FloatFunction function) { return new Match.Builder().caze(function); } public static Match.Builder caze(IntFunction function) { return new Match.Builder().caze(function); } public static Match.Builder caze(LongFunction function) { return new Match.Builder().caze(function); } public static Match.Builder caze(ShortFunction function) { return new Match.Builder().caze(function); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy