parent
4ddb56e211
commit
e7dd1a131e
@ -0,0 +1,20 @@ |
||||
package me.bearns.fias.helpers; |
||||
|
||||
import me.bearns.fias.exceptions.UnmarshallingException; |
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; |
||||
|
||||
import java.util.function.BiConsumer; |
||||
|
||||
public interface ThrowingBiConsumer<K extends UnmarshallerParameters, V extends ZipArchiveEntry, E extends Throwable> { |
||||
void accept(K k, V v) throws E; |
||||
|
||||
static <K extends UnmarshallerParameters, V extends ZipArchiveEntry, E extends Throwable> BiConsumer<K,V> unchecked(ThrowingBiConsumer<K, V, E> f) { |
||||
return (k,v) -> { |
||||
try { |
||||
f.accept(k,v); |
||||
} catch (Throwable e) { |
||||
throw new RuntimeException(e); |
||||
}; |
||||
}; |
||||
} |
||||
} |
Loading…
Reference in new issue