listStr集合算法。
intersectionListStr
#function intersectionListStr ($left, $right)
#set($intersection = $vs.util.newList())
#foreach ($row in $left)
#if ($vs.util.isNotNull($row) and $right.contains($row) and !$intersection.contains($row))
$intersection.add($row)
#end
#end
#foreach ($row in $right)
#if ($vs.util.isNotNull($row) and $left.contains($row) and !$intersection.contains($row))
$intersection.add($row)
#end
#end
return $intersection
#end
unionListStr
#function unionListStr ($left, $right)
#set($union = $vs.util.newList())
#foreach ($row in $left)
#if ($vs.util.isNotNull($row) and !$union.contains($row))
$union.add($row)
#end
#end
#foreach ($rowin $right)
#if ($vs.util.isNotNull($row) and !$union.contains($row))
$union.add($row)
#end
#end
#end
differenceListStr
#function differenceListStr ($left, $right)
#set($difference = $vs.util.newList())
#foreach ($row in $left)
#if ($vs.util.isNotNull($row) and !$right.contains($row) and !$difference.contains($row))
$difference.add($row)
#end
#end
return $difference
#end
equalsListStr
#function equalsListStr ($left, $right)
#if ($vs.util.isNull($left) and $vs.util.isNull($right))
return true
#end
#if ($vs.util.isList($left) and $vs.util.isList($right))
#if ($left.size() ne $right.size())
return false
#end
#foreach ($row in $right)
#if (!$left.contains($row))
return false
#end
#end
return true
#else
return false
#end
#end
其它
simpleDifferenceSet
#function simpleDifferenceSet ($a, $b, $fieldId)
#set($result = $vs.util.newList())
#set($set = @collectSet($b, $fieldId))
#foreach ($row in $a)
#set($value = $row)
#if ($vs.util.isNotNull($fieldId))
#set($value = $row.get($fieldId))
#end
#if ($vs.util.isNotNull($value) and !$set.contains($fieldId))
$result.add($row)
#end
#end
return $result
#end