mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-03 03:12:25 +08:00
优化说明
This commit is contained in:
@@ -5,6 +5,12 @@ import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* List工具,用于构建list等操作
|
||||
* <pre>
|
||||
* Lists.buildList("1","2")
|
||||
* .add("3")
|
||||
* .add("4","5","6")
|
||||
* .get();
|
||||
* </pre>
|
||||
*
|
||||
* @author zhouhao
|
||||
*/
|
||||
@@ -30,11 +36,15 @@ public class Lists {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public ListBuilder<V> add(V value) {
|
||||
public ListBuilder<V> add(V value, V... more) {
|
||||
this.target.add(value);
|
||||
if (more.length > 0) {
|
||||
addAll(Arrays.asList(more));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public ListBuilder<V> addAll(Collection<V> value) {
|
||||
this.target.addAll(value);
|
||||
return this;
|
||||
@@ -45,4 +55,5 @@ public class Lists {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user