mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix doc
This commit is contained in:
parent
e0848d2b68
commit
fc1dedb345
@ -246,12 +246,14 @@ public class Opt<T> {
|
|||||||
* 如果包裹里元素的值存在,就执行对应的操作,并返回本身
|
* 如果包裹里元素的值存在,就执行对应的操作,并返回本身
|
||||||
* 如果不存在,返回一个空的{@code Opt}
|
* 如果不存在,返回一个空的{@code Opt}
|
||||||
*
|
*
|
||||||
|
* <p>属于 {@link #ifPresent}的链式拓展
|
||||||
|
*
|
||||||
* @param action 值存在时执行的操作
|
* @param action 值存在时执行的操作
|
||||||
|
* @return this
|
||||||
* @throws NullPointerException 如果值存在,并且传入的操作为 {@code null}
|
* @throws NullPointerException 如果值存在,并且传入的操作为 {@code null}
|
||||||
* @apiNote 属于 {@link #ifPresent}的链式拓展
|
|
||||||
* @author VampireAchao
|
* @author VampireAchao
|
||||||
*/
|
*/
|
||||||
public Opt<T> peek(Consumer<T> action) {
|
public Opt<T> peek(Consumer<T> action) throws NullPointerException {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
return Opt.empty();
|
return Opt.empty();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user