新增 base 和 function 的包说明

dev
ZhouXY108 2024-11-28 16:36:47 +08:00
parent 96f7eac10a
commit 355be9625a
2 changed files with 121 additions and 0 deletions

View File

@ -0,0 +1,76 @@
/*
* Copyright 2024 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.
*/
/**
*
*
* <h2>Ref</h2>
* <p>
* {@link Ref} {@link BoolRef}{@link ByteRef}{@link CharRef}
* {@link DoubleRef}{@link IntRef}{@link LongRef}
* </p>
* <p> C# {@value ref} C# </p>
* <pre>
* void Method(ref int refArgument)
* {
* refArgument = refArgument + 44;
* }
*
* int number = 1;
* Method(ref number);
* Console.WriteLine(number); // Output: 45
* </pre>
* {@link Ref} {@code XxxRef} 使 Java
* <pre>
* void method(IntRef refArgument) {
* refArgument.apply(i -> i + 44);
* }
*
* IntRef number = IntRef.of(1);
* method(number);
* System.out.println(number.getValue()); // Output: 45
* </pre>
* <p>
* 使 {@link Ref} {@link Ref}
* 使 {@code getValue()}
* </p>
* <pre>
* String method(IntRef intRefArgument, Ref<String> strRefArgument) {
* intRefArgument.apply(i -> i + 44);
* strRefArgument.setValue("Hello " + strRefArgument.getValue());
* return "Return string";
* }
*
* IntRef number = IntRef.of(1);
* Ref<String> str = Ref.of("Java");
* String result = method(number, str);
* System.out.println(number.getValue()); // Output: 45
* System.out.println(str.getValue()); // Output: Hello Java
* System.out.println(result); // Output: Return string
* </pre>
*
* <h2>IWithCode</h2>
* <p>
*
* {@link IWithCode}{@link IWithIntCode}{@link IWithLongCode}便
* </p>
*
* <h2>JRE</h2>
* <p>
* {@link JRE} Java
* </p>
*/
package xyz.zhouxy.plusone.commons.base;

View File

@ -0,0 +1,45 @@
/*
* Copyright 2024 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.
*/
/**
*
*
* <h2>PredicateTools</h2>
* <p>
* {@link PredicateTools} {@link java.util.function.Predicate}
* </p>
*
* <h2>Functional interfaces</h2>
* <p>
* JDK
* <pre>
* | Group | FunctionalInterface | method |
* | ------------- | -------------------- | -------------------------------- |
* | UnaryOperator | BoolUnaryOperator | boolean applyAsBool (boolean) |
* | UnaryOperator | ByteUnaryOperator | byte applyAsByte(byte) |
* | UnaryOperator | CharUnaryOperator | char applyAsChar(char) |
* | Throwing | Executable | void execute() throws E |
* | Throwing | ThrowingConsumer | void accept(T) throws E |
* | Throwing | ThrowingFunction | R apply(T) throws E |
* | Throwing | ThrowingPredicate | boolean test(T) throws E |
* | Throwing | ThrowingSupplier | T get() throws E |
* | Optional | OptionalSupplier | Optional&lt;T&gt; get() throws E |
* | Optional | ToOptionalBiFunction | Optional&lt;R&gt; apply(T,U) |
* | Optional | ToOptionalFunction | Optional&lt;R&gt; apply(T) |
* </pre>
* </p>
*/
package xyz.zhouxy.plusone.commons.function;