add SetUtil

This commit is contained in:
Looly
2022-05-07 12:18:29 +08:00
parent ab0448e0fd
commit 029a603d5f
56 changed files with 434 additions and 625 deletions

View File

@@ -1,6 +1,6 @@
package cn.hutool.db;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.func.Func1;
import cn.hutool.db.dialect.Dialect;
import cn.hutool.db.handler.BeanListHandler;
@@ -554,7 +554,7 @@ public abstract class AbstractDb<R extends AbstractDb<R>> extends DefaultConnect
* @throws DbRuntimeException SQL执行异常
*/
public <T> T find(final Entity where, final RsHandler<T> rsh, final String... fields) throws DbRuntimeException {
return find(CollUtil.newArrayList(fields), where, rsh);
return find(ListUtil.toList(fields), where, rsh);
}
/**

View File

@@ -1,6 +1,7 @@
package cn.hutool.db;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.SetUtil;
import cn.hutool.core.lang.func.Func0;
import cn.hutool.core.map.Dict;
import cn.hutool.core.reflect.MethodUtil;
@@ -155,7 +156,7 @@ public class Entity extends Dict {
*/
public Entity setFieldNames(final Collection<String> fieldNames) {
if (CollUtil.isNotEmpty(fieldNames)) {
this.fieldNames = CollUtil.newHashSet(true, fieldNames);
this.fieldNames = SetUtil.newHashSet(true, fieldNames);
}
return this;
}
@@ -168,7 +169,7 @@ public class Entity extends Dict {
*/
public Entity setFieldNames(final String... fieldNames) {
if (ArrayUtil.isNotEmpty(fieldNames)) {
this.fieldNames = CollUtil.newLinkedHashSet(fieldNames);
this.fieldNames = SetUtil.newLinkedHashSet(fieldNames);
}
return this;
}

View File

@@ -1,6 +1,6 @@
package cn.hutool.db.sql;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.db.DbRuntimeException;
import cn.hutool.db.Entity;
@@ -113,7 +113,7 @@ public class Query implements Cloneable {
* @return this
*/
public Query setFields(final String... fields) {
this.fields = CollUtil.newArrayList(fields);
this.fields = ListUtil.toList(fields);
return this;
}