优化说明

This commit is contained in:
zhouhao
2017-08-25 09:41:46 +08:00
parent 49b91ce5e5
commit dfbcfc5c19

View File

@@ -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 {
}
}
}