CheckedBiFunction.java

1
/*-
2
 * #%L
3
 * io.earcam.unexceptional
4
 * %%
5
 * Copyright (C) 2016 - 2017 earcam
6
 * %%
7
 * SPDX-License-Identifier: (BSD-3-Clause OR EPL-1.0 OR Apache-2.0 OR MIT)
8
 * 
9
 * You <b>must</b> choose to accept, in full - any individual or combination of 
10
 * the following licenses:
11
 * <ul>
12
 * 	<li><a href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</a></li>
13
 * 	<li><a href="https://www.eclipse.org/legal/epl-v10.html">EPL-1.0</a></li>
14
 * 	<li><a href="https://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></li>
15
 * 	<li><a href="https://opensource.org/licenses/MIT">MIT</a></li>
16
 * </ul>
17
 * #L%
18
 */
19
package io.earcam.unexceptional;
20
21
import java.util.Objects;
22
23
/**
24
 * A checked parallel of {@link java.util.function.BiFunction}
25
 * 
26
 * @param <T> first argument type
27
 * @param <U> second argument type
28
 * @param <R> return type
29
 * 
30
 * @since 0.2.0
31
 * 
32
 * @see java.util.function.BiFunction
33
 */
34
@FunctionalInterface
35
public interface CheckedBiFunction<T, U, R, E extends Throwable> {
36
37
	/**
38
	 * See {@link java.util.function.BiFunction#apply(Object, Object)}
39
	 * 
40
	 * @param t first argument.
41
	 * @param u second argument.
42
	 * @return result of applying {@code this} function.
43
	 * @throws Throwable a possible checked exception
44
	 */
45
	public abstract R apply(T t, U u) throws E;
46
47
48
	/**
49
	 * See {@link java.util.function.BiFunction#andThen(java.util.function.Function)}
50
	 * 
51
	 * @param <V> the return type of the {@code after} parameter
52
	 * 
53
	 * @param after the {@link CheckedFunction} to be chained (taking result of {@code this} as argument)
54
	 * @return the composite {@link CheckedBiFunction}
55
	 * @throws NullPointerException if {@code after} is {@code null}
56
	 */
57
	public default <V> CheckedBiFunction<T, U, V, E> andThen(CheckedFunction<? super R, ? extends V, ? extends E> after)
58
	{
59
		Objects.requireNonNull(after);
60 2 1. andThen : mutated return of Object value for io/earcam/unexceptional/CheckedBiFunction::andThen to ( if (x != null) null else throw new RuntimeException ) → KILLED
2. lambda$andThen$82231ee7$1 : mutated return of Object value for io/earcam/unexceptional/CheckedBiFunction::lambda$andThen$82231ee7$1 to ( if (x != null) null else throw new RuntimeException ) → KILLED
		return (CheckedBiFunction<T, U, V, E> & java.io.Serializable) (T t, U u) -> after.apply(apply(t, u));
61
	}
62
}

Mutations

60

1.1
Location : andThen
Killed by : io.earcam.unexceptional.CheckedBiFunctionTest.andThenChains()
mutated return of Object value for io/earcam/unexceptional/CheckedBiFunction::andThen to ( if (x != null) null else throw new RuntimeException ) → KILLED

2.2
Location : lambda$andThen$82231ee7$1
Killed by : io.earcam.unexceptional.CheckedBiFunctionTest.andThenChains()
mutated return of Object value for io/earcam/unexceptional/CheckedBiFunction::lambda$andThen$82231ee7$1 to ( if (x != null) null else throw new RuntimeException ) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.4.0