This commit is contained in:
Looly 2022-03-28 03:53:50 +08:00
parent 2dde8d18d0
commit 8c349c6082
4 changed files with 12 additions and 36 deletions

View File

@ -103,8 +103,9 @@ public class Opt<T> {
/** /**
* 返回一个包裹里{@code List}集合可能为空的{@code Opt}额外判断了集合内元素为空的情况 * 返回一个包裹里{@code List}集合可能为空的{@code Opt}额外判断了集合内元素为空的情况
* *
* @param value 传入需要包裹的元素
* @param <T> 包裹里元素的类型 * @param <T> 包裹里元素的类型
* @param <R> 集合值类型
* @param value 传入需要包裹的元素
* @return 一个包裹里元素可能为空的 {@code Opt} * @return 一个包裹里元素可能为空的 {@code Opt}
* @since 5.7.17 * @since 5.7.17
*/ */
@ -113,7 +114,6 @@ public class Opt<T> {
} }
/** /**
*
* @param supplier 操作 * @param supplier 操作
* @param <T> 类型 * @param <T> 类型
* @return 操作执行后的值 * @return 操作执行后的值
@ -175,7 +175,7 @@ public class Opt<T> {
* @return 异常 * @return 异常
* @since 5.7.17 * @since 5.7.17
*/ */
public Exception getException(){ public Exception getException() {
return this.exception; return this.exception;
} }
@ -186,7 +186,7 @@ public class Opt<T> {
* @return 是否失败 * @return 是否失败
* @since 5.7.17 * @since 5.7.17
*/ */
public boolean isFail(){ public boolean isFail() {
return null != this.exception; return null != this.exception;
} }
@ -253,7 +253,7 @@ public class Opt<T> {
* String hutool = Opt.ofBlankAble("hutool").mapOrElse(String::toUpperCase, () -> Console.log("yes")).mapOrElse(String::intern, () -> Console.log("Value is not present~")).get(); * String hutool = Opt.ofBlankAble("hutool").mapOrElse(String::toUpperCase, () -> Console.log("yes")).mapOrElse(String::intern, () -> Console.log("Value is not present~")).get();
* }</pre> * }</pre>
* *
* @param <U> map后新的类型 * @param <U> map后新的类型
* @param mapper 包裹里的值存在时的操作 * @param mapper 包裹里的值存在时的操作
* @param emptyAction 包裹里的值不存在时的操作 * @param emptyAction 包裹里的值不存在时的操作
* @return 新的类型的Opt * @return 新的类型的Opt
@ -443,7 +443,7 @@ public class Opt<T> {
* @return 如果未发生异常则返回该值否则返回传入的{@code other} * @return 如果未发生异常则返回该值否则返回传入的{@code other}
* @since 5.7.17 * @since 5.7.17
*/ */
public T exceptionOrElse(T other){ public T exceptionOrElse(T other) {
return isFail() ? other : value; return isFail() ? other : value;
} }

View File

@ -23,19 +23,6 @@ public class LambdaUtil {
/** /**
* 通过对象的方法或类的静态方法引用获取lambda实现类 * 通过对象的方法或类的静态方法引用获取lambda实现类
* 传入lambda无参数但含有返回值的情况能够匹配到此方法 * 传入lambda无参数但含有返回值的情况能够匹配到此方法
* <pre>{@code
* @Data
* @EqualsAndHashCode(callSuper = true)
* static class MyTeacher extends Entity&lt;MyTeacher&gt; {
*
* public String age;
*
* public static String takeAge() {
* return new MyTeacher().getAge();
* }
*
* }
* }</pre>
* <ul> * <ul>
* <li>引用特定对象的实例方法<pre>{@code * <li>引用特定对象的实例方法<pre>{@code
* MyTeacher myTeacher = new MyTeacher(); * MyTeacher myTeacher = new MyTeacher();
@ -124,19 +111,6 @@ public class LambdaUtil {
/** /**
* 通过对象的方法或类的静态方法引用然后根据{@link SerializedLambda#getInstantiatedMethodType()}获取lambda实现类<br> * 通过对象的方法或类的静态方法引用然后根据{@link SerializedLambda#getInstantiatedMethodType()}获取lambda实现类<br>
* 传入lambda有参数且含有返回值的情况能够匹配到此方法 * 传入lambda有参数且含有返回值的情况能够匹配到此方法
* <pre>{@code
* @Data
* @EqualsAndHashCode(callSuper = true)
* static class MyTeacher extends Entity&lt;MyTeacher&gt; {
*
* public String age;
*
* public static String takeAgeBy(MyTeacher myTeacher) {
* return myTeacher.getAge();
* }
*
* }
* }</pre>
* <ul> * <ul>
* <li>引用特定类型的任意对象的实例方法<pre>{@code * <li>引用特定类型的任意对象的实例方法<pre>{@code
* Class<MyTeacher> functionClass = LambdaUtil.getRealClass(MyTeacher::getAge); * Class<MyTeacher> functionClass = LambdaUtil.getRealClass(MyTeacher::getAge);

View File

@ -680,7 +680,7 @@ public class MapUtil {
* @param <K> {@code key}的类型 * @param <K> {@code key}的类型
* @param <V> {@code value}的类型 * @param <V> {@code value}的类型
* @param <R> 新的修改后的{@code value}的类型 * @param <R> 新的修改后的{@code value}的类型
* @return 值可以为不同类型的 {@link Map * @return 值可以为不同类型的 {@link Map}
* @since 5.8.0 * @since 5.8.0
*/ */
public static <K, V, R> Map<K, R> map(Map<K, V> map, BiFunction<K, V, R> biFunction) { public static <K, V, R> Map<K, R> map(Map<K, V> map, BiFunction<K, V, R> biFunction) {

View File

@ -136,8 +136,8 @@ public class AntPathMatcher {
* are coming in, with little chance for encountering a recurring pattern. * are coming in, with little chance for encountering a recurring pattern.
* *
* @param cachePatterns 是否缓存表达式 * @param cachePatterns 是否缓存表达式
* @see #getStringMatcher(String)
* @return this * @return this
* @see #getStringMatcher(String)
*/ */
public AntPathMatcher setCachePatterns(boolean cachePatterns) { public AntPathMatcher setCachePatterns(boolean cachePatterns) {
this.cachePatterns = cachePatterns; this.cachePatterns = cachePatterns;
@ -178,7 +178,7 @@ public class AntPathMatcher {
* 给定路径是否匹配表达式 * 给定路径是否匹配表达式
* *
* @param pattern 表达式 * @param pattern 表达式
* @param path 路径 * @param path 路径
* @return 是否匹配 * @return 是否匹配
*/ */
public boolean match(String pattern, String path) { public boolean match(String pattern, String path) {
@ -189,7 +189,7 @@ public class AntPathMatcher {
* 前置部分匹配 * 前置部分匹配
* *
* @param pattern 表达式 * @param pattern 表达式
* @param path 路径 * @param path 路径
* @return 是否匹配 * @return 是否匹配
*/ */
public boolean matchStart(String pattern, String path) { public boolean matchStart(String pattern, String path) {
@ -708,6 +708,8 @@ public class AntPathMatcher {
/** /**
* Main entry point. * Main entry point.
* *
* @param str Str
* @param uriTemplateVariables uri template vars
* @return {@code true} if the string matches against the pattern, or {@code false} otherwise. * @return {@code true} if the string matches against the pattern, or {@code false} otherwise.
*/ */
public boolean matchStrings(String str, Map<String, String> uriTemplateVariables) { public boolean matchStrings(String str, Map<String, String> uriTemplateVariables) {