2020
09-27
09-27
Java throw Exception实现异常转换
简介之前的文章我们讲到,在stream中处理异常,需要将checkedexception转换为uncheckedexception来处理。我们是这样做的:static<T>Consumer<T>consumerWrapper(ThrowingConsumer<T,Exception>throwingConsumer){returni->{try{throwingConsumer.accept(i);}catch(Exceptionex){thrownewRuntimeException(ex);}};}将异常捕获,然后封装成为RuntimeExceptio...
继续阅读 >