upgrade Try.java

This commit is contained in:
ehlxr 2021-02-04 15:52:17 +08:00
parent a024d0c01f
commit c52cc632fe

View File

@ -265,7 +265,7 @@ public interface Try {
*/ */
public void accept(P p) { public void accept(P p) {
try { try {
Objects.requireNonNull(p, "No accept p present"); Objects.requireNonNull(p, "No accept param present");
consumer.accept(p); consumer.accept(p);
} catch (final Throwable e) { } catch (final Throwable e) {
@ -294,7 +294,7 @@ public interface Try {
* @return {@link TryFunction} * @return {@link TryFunction}
*/ */
public TryFunction<P, R> apply(P p) { public TryFunction<P, R> apply(P p) {
Objects.requireNonNull(p, "Apply p should not null"); Objects.requireNonNull(p, "Apply param should not null");
this.p = p; this.p = p;
return this; return this;
@ -308,7 +308,7 @@ public interface Try {
*/ */
public R get(R r) { public R get(R r) {
try { try {
Objects.requireNonNull(function, "No apply p present"); Objects.requireNonNull(function, "No apply param present");
return function.apply(p); return function.apply(p);
} catch (final Throwable e) { } catch (final Throwable e) {
@ -326,7 +326,7 @@ public interface Try {
*/ */
public R get() { public R get() {
try { try {
Objects.requireNonNull(p, "No apply p present"); Objects.requireNonNull(p, "No apply param present");
return function.apply(p); return function.apply(p);
} catch (final Throwable e) { } catch (final Throwable e) {