Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. package com.github.maikoncanuto.test;
  2.  
  3.  
  4. import java.util.function.Supplier;
  5.  
  6. public interface Validacao<T> {
  7.  
  8. default <X extends Throwable> Validacao<? extends T> orElseThrow(Boolean valid, Supplier<? extends X> exceptionSupplier) throws X {
  9. if (valid)
  10. return this;
  11. else
  12. throw exceptionSupplier.get();
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement