guava/src/com/google/common/base/Throwables.java
public static void throwIfUnchecked(Throwable throwable) {
    checkNotNull(throwable);
    if (throwable instanceof RuntimeException) {
      throw (RuntimeException) throwable;
    }
    if (throwable instanceof Error) {
      throw (Error) throwable;
    }
  }
public static void throwIfUnchecked(Throwable throwable) {
    checkNotNull(throwable);
    if (throwable instanceof RuntimeException) {
      throw (RuntimeException) throwable;
    }
    if (throwable instanceof Error) {
      throw (Error) throwable;
    }
  }
Throws {@code throwable} if it is a {@link RuntimeException} or {@link Error}. Example usage:

<pre>
for (Foo foo : foos) {
try {
foo.bar();
} catch (RuntimeException | Error t) {
failure = t;
}
}
if (failure != null) {
throwIfUnchecked(failure);
throw new AssertionError(failure);
}
</pre>

@since 20.0