diff --git a/CHANGELOG.md b/CHANGELOG.md
index fcd3d51bd..dfefa113b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,14 +2,20 @@
# 🚀Changelog
-------------------------------------------------------------------------------------------------------------
-# 5.7.23 (2022-03-04)
+# 5.7.23 (2022-03-09)
### 🐣新特性
* 【http 】 HttpRequest.form采用TableMap方式(issue#I4W427@Gitee)
* 【core 】 AnnotationUtil增加getAnnotationAlias方法(pr#554@Gitee)
* 【core 】 FileUtil.extName增加对tar.gz特殊处理(issue#I4W5FS@Gitee)
+* 【crypto 】 增加XXTEA实现(issue#I4WH2X@Gitee)
+* 【core 】 增加Table实现(issue#2179@Github)
+* 【core 】 增加UniqueKeySet(issue#I4WUWR@Gitee)
+*
### 🐞Bug修复
* 【core 】 修复ObjectUtil.hasNull传入null返回true的问题(pr#555@Gitee)
+* 【core 】 修复NumberConverter对数字转换的问题(issue#I4WPF4@Gitee)
+* 【core 】 修复ReflectUtil.getMethods获取接口方法问题(issue#I4WUWR@Gitee)
-------------------------------------------------------------------------------------------------------------
# 5.7.22 (2022-03-01)
diff --git a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationProxy.java b/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationProxy.java
index a61ff6668..bcf2ba4b5 100644
--- a/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationProxy.java
+++ b/hutool-core/src/main/java/cn/hutool/core/annotation/AnnotationProxy.java
@@ -39,7 +39,7 @@ public class AnnotationProxy
this object
+ * @param lhs {@code this} object
* @param rhs the other object
* @return the pair
*/
@@ -82,15 +82,15 @@ public class EqualsBuilder implements Builder
- * Returns true if the registry contains the given object pair.
+ * Returns {@code true} if the registry contains the given object pair.
* Used by the reflection methods to avoid infinite loops.
* Objects might be swapped therefore a check is needed if the object pair
* is registered in given or swapped order.
*
this object to lookup in registry
+ * @param lhs {@code this} object to lookup in registry
* @param rhs the other object to lookup on registry
- * @return boolean true if the registry contains the given object.
+ * @return boolean {@code true} if the registry contains the given object.
* @since 3.0
*/
static boolean isRegistered(final Object lhs, final Object rhs) {
@@ -108,7 +108,7 @@ public class EqualsBuilder implements Builderthis object to register
+ * @param lhs {@code this} object to register
* @param rhs the other object to register
*/
static void register(final Object lhs, final Object rhs) {
@@ -131,7 +131,7 @@ public class EqualsBuilder implements Builder
* Used by the reflection methods to avoid infinite loops.
*
- * @param lhs This method uses reflection to determine if the two This method uses reflection to determine if the two {@code Object}s
* are equal. It uses It uses {@code AccessibleObject.setAccessible} to gain access to private
* fields. This means that it will throw a security exception if run under
* a security manager, if the permissions are not set up correctly. It is also
* not as efficient as testing explicitly. Non-primitive fields are compared using
- * this object to unregister
+ * @param lhs {@code this} object to unregister
* @param rhs the other object to unregister
* @since 3.0
*/
@@ -170,7 +170,7 @@ public class EqualsBuilder implements Buildertrue
+ * @return 两个对象是否equals,是返回{@code true}
*/
public static boolean reflectionEquals(final Object lhs, final Object rhs, final Collectiontrue
+ * @return 两个对象是否equals,是返回{@code true}
*/
public static boolean reflectionEquals(final Object lhs, final Object rhs, final String... excludeFields) {
return reflectionEquals(lhs, rhs, false, null, excludeFields);
}
/**
- * Objects
+ * AccessibleObject.setAccessible to gain access to private
+ * equals().
If the TestTransients parameter is set to true, transient
+ *
If the TestTransients parameter is set to {@code true}, transient
* members will be tested, otherwise they are ignored, as they are likely
- * derived fields, and not part of the value of the Object.
Static fields will not be tested. Superclass fields will be included.
* - * @param lhsthis object
+ * @param lhs {@code this} object
* @param rhs the other object
* @param testTransients whether to include transient fields
- * @return true if the two Objects have tested equals.
+ * @return {@code true} if the two Objects have tested equals.
*/
public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients) {
return reflectionEquals(lhs, rhs, testTransients, null);
}
/**
- * This method uses reflection to determine if the two Objects
+ *
This method uses reflection to determine if the two {@code Object}s * are equal.
* - *It uses AccessibleObject.setAccessible to gain access to private
+ *
It uses {@code AccessibleObject.setAccessible} to gain access to private
* fields. This means that it will throw a security exception if run under
* a security manager, if the permissions are not set up correctly. It is also
* not as efficient as testing explicitly. Non-primitive fields are compared using
- * equals().
If the testTransients parameter is set to true, transient
+ *
If the testTransients parameter is set to {@code true}, transient
* members will be tested, otherwise they are ignored, as they are likely
- * derived fields, and not part of the value of the Object.
Static fields will not be included. Superclass fields will be appended * up to and including the specified superclass. A null superclass is treated * as java.lang.Object.
* - * @param lhsthis object
+ * @param lhs {@code this} object
* @param rhs the other object
* @param testTransients whether to include transient fields
* @param reflectUpToClass the superclass to reflect up to (inclusive),
- * may be null
+ * may be {@code null}
* @param excludeFields array of field names to exclude from testing
- * @return true if the two Objects have tested equals.
+ * @return {@code true} if the two Objects have tested equals.
* @since 2.0
*/
public static boolean reflectionEquals(final Object lhs, final Object rhs, final boolean testTransients, final Class> reflectUpToClass,
@@ -343,9 +343,9 @@ public class EqualsBuilder implements BuilderAdds the result of super.equals() to this builder.
Adds the result of {@code super.equals()} to this builder.
* - * @param superEquals the result of callingsuper.equals()
+ * @param superEquals the result of calling {@code super.equals()}
* @return EqualsBuilder - used to chain calls.
* @since 2.0
*/
@@ -360,8 +360,8 @@ public class EqualsBuilder implements BuilderTest if two Objects are equal using their
- * equals method.
Test if two {@code Object}s are equal using their + * {@code equals} method.
* * @param lhs the left hand object * @param rhs the right hand object @@ -388,11 +388,11 @@ public class EqualsBuilder implements Builder
- * Test if two long s are equal.
+ * Test if two {@code long} s are equal.
*
long
- * @param rhs the right hand long
+ * @param lhs the left hand {@code long}
+ * @param rhs the right hand {@code long}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final long lhs, final long rhs) {
@@ -404,10 +404,10 @@ public class EqualsBuilder implements BuilderTest if two ints are equal.
Test if two {@code int}s are equal.
* - * @param lhs the left handint
- * @param rhs the right hand int
+ * @param lhs the left hand {@code int}
+ * @param rhs the right hand {@code int}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final int lhs, final int rhs) {
@@ -419,10 +419,10 @@ public class EqualsBuilder implements BuilderTest if two shorts are equal.
Test if two {@code short}s are equal.
* - * @param lhs the left handshort
- * @param rhs the right hand short
+ * @param lhs the left hand {@code short}
+ * @param rhs the right hand {@code short}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final short lhs, final short rhs) {
@@ -434,10 +434,10 @@ public class EqualsBuilder implements BuilderTest if two chars are equal.
Test if two {@code char}s are equal.
* - * @param lhs the left handchar
- * @param rhs the right hand char
+ * @param lhs the left hand {@code char}
+ * @param rhs the right hand {@code char}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final char lhs, final char rhs) {
@@ -449,10 +449,10 @@ public class EqualsBuilder implements BuilderTest if two bytes are equal.
Test if two {@code byte}s are equal.
* - * @param lhs the left handbyte
- * @param rhs the right hand byte
+ * @param lhs the left hand {@code byte}
+ * @param rhs the right hand {@code byte}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final byte lhs, final byte rhs) {
@@ -464,16 +464,16 @@ public class EqualsBuilder implements BuilderTest if two doubles are equal by testing that the
- * pattern of bits returned by doubleToLong are equal.
Test if two {@code double}s are equal by testing that the + * pattern of bits returned by {@code doubleToLong} are equal.
* - *This handles NaNs, Infinities, and -0.0.
This handles NaNs, Infinities, and {@code -0.0}.
* *It is compatible with the hash code generated by
- * HashCodeBuilder.
double
- * @param rhs the right hand double
+ * @param lhs the left hand {@code double}
+ * @param rhs the right hand {@code double}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final double lhs, final double rhs) {
@@ -484,16 +484,16 @@ public class EqualsBuilder implements BuilderTest if two floats are equal byt testing that the
+ *
Test if two {@code float}s are equal byt testing that the * pattern of bits returned by doubleToLong are equal.
* - *This handles NaNs, Infinities, and -0.0.
This handles NaNs, Infinities, and {@code -0.0}.
* *It is compatible with the hash code generated by
- * HashCodeBuilder.
float
- * @param rhs the right hand float
+ * @param lhs the left hand {@code float}
+ * @param rhs the right hand {@code float}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final float lhs, final float rhs) {
@@ -504,10 +504,10 @@ public class EqualsBuilder implements BuilderTest if two booleanss are equal.
Test if two {@code booleans}s are equal.
* - * @param lhs the left handboolean
- * @param rhs the right hand boolean
+ * @param lhs the left hand {@code boolean}
+ * @param rhs the right hand {@code boolean}
* @return EqualsBuilder - used to chain calls.
*/
public EqualsBuilder append(final boolean lhs, final boolean rhs) {
@@ -519,7 +519,7 @@ public class EqualsBuilder implements BuilderReturns true if the fields that have been checked
+ *
Returns {@code true} if the fields that have been checked * are all equal.
* * @return boolean @@ -529,11 +529,11 @@ public class EqualsBuilder implements BuilderReturns true if the fields that have been checked
+ *
Returns {@code true} if the fields that have been checked * are all equal.
* - * @returntrue if all of the fields that have been checked
- * are equal, false otherwise.
+ * @return {@code true} if all of the fields that have been checked
+ * are equal, {@code false} otherwise.
* @since 3.0
*/
@Override
@@ -542,7 +542,7 @@ public class EqualsBuilder implements BuilderisEquals value.
+ * Sets the {@code isEquals} value.
*
* @param isEquals The value to set.
* @return this
diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java b/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
index f03451bc3..2634eefae 100644
--- a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
+++ b/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
@@ -906,4 +906,19 @@ public class IterUtil {
// 当两个Iterable长度不一致时返回false
return false == (it1.hasNext() || it2.hasNext());
}
+
+ /**
+ * 清空指定{@link Iterator},此方法遍历后调用{@link Iterator#remove()}移除每个元素
+ *
+ * @param iterator {@link Iterator}
+ * @since 5.7.23
+ */
+ public static void clear(Iterator> iterator) {
+ if (null != iterator) {
+ while (iterator.hasNext()) {
+ iterator.next();
+ iterator.remove();
+ }
+ }
+ }
}
diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/UniqueKeySet.java b/hutool-core/src/main/java/cn/hutool/core/collection/UniqueKeySet.java
new file mode 100644
index 000000000..f4fbcb15c
--- /dev/null
+++ b/hutool-core/src/main/java/cn/hutool/core/collection/UniqueKeySet.java
@@ -0,0 +1,152 @@
+package cn.hutool.core.collection;
+
+import cn.hutool.core.map.MapBuilder;
+import cn.hutool.core.util.ObjectUtil;
+
+import java.io.Serializable;
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.function.Function;
+
+/**
+ * 唯一键的Set
+ * {@code Set set = new UniqueKeySet<>(UniqueTestBean::getId);}
+ *
+ *
+ * @param | 时间戳 | + *机器ID | + *进程ID | + *自增计数器 | + *
| 4 | + *3 | + *2 | + *3 | + *