增加List打乱函数

This commit is contained in:
mxd 2019-11-02 16:45:34 +08:00
parent c1c79c8683
commit 9caafb8f04

View File

@ -1,5 +1,6 @@
package org.spiderflow.core.executor.function.extension;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
@ -34,5 +35,12 @@ public class ListFunctionExtension implements FunctionExtension{
public static String join(List<?> list,String separator){
return StringUtils.join(list.toArray(),separator);
}
@Comment("将list打乱顺序")
@Example("${listVar.shuffle()}")
public static List<?> shuffle(List<?> list){
Collections.shuffle(list);
return list;
}
}