com.diffplug.common.base.Throwing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of durian Show documentation
Show all versions of durian Show documentation
Durian - Guava's spikier (unofficial) cousin
/**
* Copyright 2015 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.common.base;
/**
* Versions of the standard functional interfaces which throw Throwable.
*
* ErrorHandler can convert these into standard functional interfaces.
*/
public interface Throwing {
/** Versions of the standard functional interfaces which throw a specific exception type. */
public interface Specific {
@FunctionalInterface
public interface Runnable {
void run() throws E;
}
@FunctionalInterface
public interface Supplier {
T get() throws E;
}
@FunctionalInterface
public interface Consumer {
void accept(T t) throws E;
}
@FunctionalInterface
public interface Function {
R apply(T t) throws E;
}
@FunctionalInterface
public interface Predicate {
boolean test(T t) throws E;
}
}
@FunctionalInterface
public interface Runnable extends Specific.Runnable {}
@FunctionalInterface
public interface Supplier extends Specific.Supplier {}
@FunctionalInterface
public interface Consumer extends Specific.Consumer {}
@FunctionalInterface
public interface Function extends Specific.Function {}
@FunctionalInterface
public interface Predicate extends Specific.Predicate {}
}