code: public static void ignoreException(
              Statement statement, Class<? extends Throwable> type) {
          try {
              statement.evaluate();
          } catch (RuntimeException e) {
              if (!type.isAssignableFrom(e.getClass()))
                  throw e;
          } catch (Error e) {
              if (!type.isAssignableFrom(e.getClass()))
                  throw e;
          } catch (Throwable e) {
              if (!type.isAssignableFrom(e.getClass()))
                  throw new WrappedException(e);
          }
  
      }
docs: Executes the given statement and suppresses any exception of the
  specified type that is thrown by the statement.
  <pre>
  public void doSomething() {
  MyWorker worker = new MyWorker();
  ignoreException(
  () -&gt; worker.doSomethingThatThrowsAnException(),
  IllegalArgumentException.class);
  //the following statement is executed even if the worker threw an
  //IllegalArgumentException.
  doSomethingElse();
  }
  </pre>
  <p>{@code RuntimeException}s of a different type are rethrown. Other
  exceptions of a different type are wrapped by a {@code WrappedException}
  that is thrown instead.
  
  @param statement the statement that is executed.
  @param type the type of exception that is ignored.
  @throws WrappedException if the statement throws a checked exception that
  is not of the specified {@code type}. The {@code WrappedException}'s
  cause is the checked exception.
  @throws RuntimeException if the statement throws a
  {@code RuntimeException} that is not of the specified {@code type}.
  @throws Error if the statement throws an {@code Error} that is not of the
  specified {@code type}.
  @see #ignoreException(Statement)