添加注释。
parent
025e8ac4da
commit
06fb0e7a4d
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.DoubleFunction;
|
||||
|
||||
/**
|
||||
* DoubleToOptionalFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 double 的参数,返回 {@code Optional<R>} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see Optional
|
||||
* @see DoubleFunction
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface DoubleToOptionalFunction<R> extends DoubleFunction<Optional<R>> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.IntFunction;
|
||||
|
||||
/**
|
||||
* IntToOptionalFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 int 的参数,返回 {@code Optional<R>} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see Optional
|
||||
* @see IntFunction
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface IntToOptionalFunction<R> extends IntFunction<Optional<R>> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.LongFunction;
|
||||
|
||||
/**
|
||||
* LongToOptionalFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 long 的参数,返回 {@code Optional<R>} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see Optional
|
||||
* @see LongFunction
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface LongToOptionalFunction<R> extends LongFunction<Optional<R>> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* OptionalDoubleSupplier
|
||||
*
|
||||
* <p>
|
||||
* 返回 {@link OptionalDouble} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see OptionalDouble
|
||||
* @see Supplier
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface OptionalDoubleSupplier extends Supplier<OptionalDouble> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* OptionalIntSupplier
|
||||
*
|
||||
* <p>
|
||||
* 返回 {@link OptionalInt} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see OptionalInt
|
||||
* @see Supplier
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface OptionalIntSupplier extends Supplier<OptionalInt> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.OptionalLong;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* OptionalLongSupplier
|
||||
*
|
||||
* <p>
|
||||
* 返回 {@link OptionalLong} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see OptionalLong
|
||||
* @see Supplier
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface OptionalLongSupplier extends Supplier<OptionalLong> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* OptionalSupplier
|
||||
*
|
||||
* <p>
|
||||
* 返回 {@code Optional<T>} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see Optional
|
||||
* @see Supplier
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface OptionalSupplier<T> extends Supplier<Optional<T>> {
|
||||
}
|
||||
|
|
|
@ -1,9 +1,51 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Predicates
|
||||
*
|
||||
* <p>
|
||||
* {@link Predicate} 相关操作。
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see Predicate
|
||||
*/
|
||||
public class Predicates {
|
||||
|
||||
/**
|
||||
* 将 lambda 表达式或者方法引用指明为对应类型的 {@link Predicate} 对象。
|
||||
* 如将 {@code Objects::nonNull} 明确地指定为 {@code Predicate<String>},
|
||||
* 使之可以链式调用 {@link Predicate#and(Predicate)}、{@link Predicate#or(Predicate)}
|
||||
* 等方法,连接其它 {@code Predicate<? super String>} 对象。
|
||||
*
|
||||
* <pre>
|
||||
* Predicate<String> predicate = Predicates.<String>of(Objects::nonNull)
|
||||
* .and(StringUtils::isNotEmpty);
|
||||
* </pre>
|
||||
*
|
||||
* @param <T>
|
||||
* @param predicate
|
||||
* @return
|
||||
*/
|
||||
public static <T> Predicate<T> of(Predicate<? super T> predicate) {
|
||||
return predicate::test;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* ToOptionalBiFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 T 和 U 的两个参数,返回 {@code Optional<R>} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see Optional
|
||||
* @see BiFunction
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ToOptionalBiFunction<T, U, R> extends BiFunction<T, U, Optional<R>> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.OptionalDouble;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* ToOptionalDoubleFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 T 的参数,返回 {@link OptionalDouble} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see OptionalDouble
|
||||
* @see Function
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ToOptionalDoubleFunction<T> extends Function<T, OptionalDouble> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* ToOptionalFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 T 的参数,返回 {@code Optional<R>} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see Optional
|
||||
* @see Function
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ToOptionalFunction<T, R> extends Function<T, Optional<R>> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* ToOptionalIntFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 T 的参数,返回 {@link OptionalInt} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see OptionalInt
|
||||
* @see Function
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ToOptionalIntFunction<T> extends Function<T, OptionalInt> {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,35 @@
|
|||
/*
|
||||
* Copyright 2022-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package xyz.zhouxy.plusone.commons.function;
|
||||
|
||||
import java.util.OptionalLong;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* ToOptionalLongFunction
|
||||
*
|
||||
* <p>
|
||||
* 接受类型为 T 的参数,返回 {@link OptionalLong} 对象。
|
||||
*
|
||||
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
|
||||
* @since 0.1.0
|
||||
* @see OptionalLong
|
||||
* @see Function
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ToOptionalLongFunction<T> extends Function<T, OptionalLong> {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue