diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/DoubleToOptionalFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/DoubleToOptionalFunction.java
index 7806655..3b3cbcd 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/DoubleToOptionalFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/DoubleToOptionalFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 double 的参数,返回 {@code Optional<R>} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see Optional
+ * @see DoubleFunction
+ */
@FunctionalInterface
public interface DoubleToOptionalFunction extends DoubleFunction> {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/IntToOptionalFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/IntToOptionalFunction.java
index e3a1bfb..069d2ee 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/IntToOptionalFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/IntToOptionalFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 int 的参数,返回 {@code Optional<R>} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see Optional
+ * @see IntFunction
+ */
@FunctionalInterface
public interface IntToOptionalFunction extends IntFunction> {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/LongToOptionalFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/LongToOptionalFunction.java
index 89d4b8b..820bf82 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/LongToOptionalFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/LongToOptionalFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 long 的参数,返回 {@code Optional<R>} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see Optional
+ * @see LongFunction
+ */
@FunctionalInterface
public interface LongToOptionalFunction extends LongFunction> {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalDoubleSupplier.java b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalDoubleSupplier.java
index ea79107..be0c4a2 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalDoubleSupplier.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalDoubleSupplier.java
@@ -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
+ *
+ *
+ * 返回 {@link OptionalDouble} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see OptionalDouble
+ * @see Supplier
+ */
@FunctionalInterface
public interface OptionalDoubleSupplier extends Supplier {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalIntSupplier.java b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalIntSupplier.java
index fb9e9a8..4e8a524 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalIntSupplier.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalIntSupplier.java
@@ -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
+ *
+ *
+ * 返回 {@link OptionalInt} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see OptionalInt
+ * @see Supplier
+ */
@FunctionalInterface
public interface OptionalIntSupplier extends Supplier {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalLongSupplier.java b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalLongSupplier.java
index 1c0f9d5..cdd36be 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalLongSupplier.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalLongSupplier.java
@@ -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
+ *
+ *
+ * 返回 {@link OptionalLong} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see OptionalLong
+ * @see Supplier
+ */
@FunctionalInterface
public interface OptionalLongSupplier extends Supplier {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalSupplier.java b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalSupplier.java
index 1b9098a..5b38e17 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalSupplier.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/OptionalSupplier.java
@@ -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
+ *
+ *
+ * 返回 {@code Optional<T>} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see Optional
+ * @see Supplier
+ */
@FunctionalInterface
public interface OptionalSupplier extends Supplier> {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/Predicates.java b/src/main/java/xyz/zhouxy/plusone/commons/function/Predicates.java
index b949d18..b87b325 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/Predicates.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/Predicates.java
@@ -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
+ *
+ *
+ * {@link Predicate} 相关操作。
+ *
+ *
+ * @author ZhouXY
+ * @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>} 对象。
+ *
+ *
+ * Predicate<String> predicate = Predicates.<String>of(Objects::nonNull)
+ * .and(StringUtils::isNotEmpty);
+ *
+ *
+ * @param
+ * @param predicate
+ * @return
+ */
public static Predicate of(Predicate super T> predicate) {
return predicate::test;
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalBiFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalBiFunction.java
index 25ece43..f225869 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalBiFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalBiFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 T 和 U 的两个参数,返回 {@code Optional<R>} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see Optional
+ * @see BiFunction
+ */
@FunctionalInterface
public interface ToOptionalBiFunction extends BiFunction> {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalDoubleFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalDoubleFunction.java
index 67ec3e7..dd3fe9a 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalDoubleFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalDoubleFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 T 的参数,返回 {@link OptionalDouble} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see OptionalDouble
+ * @see Function
+ */
@FunctionalInterface
public interface ToOptionalDoubleFunction extends Function {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalFunction.java
index 58125e9..7a97ab7 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 T 的参数,返回 {@code Optional<R>} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see Optional
+ * @see Function
+ */
@FunctionalInterface
public interface ToOptionalFunction extends Function> {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalIntFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalIntFunction.java
index 07078f2..9418231 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalIntFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalIntFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 T 的参数,返回 {@link OptionalInt} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see OptionalInt
+ * @see Function
+ */
@FunctionalInterface
public interface ToOptionalIntFunction extends Function {
}
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalLongFunction.java b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalLongFunction.java
index b968c56..da5fbce 100644
--- a/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalLongFunction.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/function/ToOptionalLongFunction.java
@@ -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
+ *
+ *
+ * 接受类型为 T 的参数,返回 {@link OptionalLong} 对象。
+ *
+ * @author ZhouXY
+ * @since 0.1.0
+ * @see OptionalLong
+ * @see Function
+ */
@FunctionalInterface
public interface ToOptionalLongFunction extends Function {
}