English
CollectionUtils
About 399 wordsAbout 1 min
2026-01-09
CollectionUtils
Methods for handling collections
Summary
- CollectionUtils.union(list1,list2): Returns the union of two lists
Example:
def list1 = ["A", "B", "C", "D", "E", "F"]
def list2 = ["B", "D", "F", "G", "H", "K"]
def re = CollectionUtils.union(list1, list2)
log.info(re) // [A, B, C, D, E, F, G, H, K]
```text
- CollectionUtils.intersection(list1,list2): Returns the intersection of two lists
Example:
```python
def list1 = ["A", "B", "C", "D", "E", "F"]
def list2 = ["B", "D", "F", "G", "H", "K"]
def re = CollectionUtils.intersection(list1, list2)
log.info(re) //[B, D, F]
```text
- CollectionUtils.disjunction(list1,list2): Returns the complement of the intersection of two lists (disjunction)
Example:
```python
def list1 = ["A", "B", "C", "D", "E", "F"]
def list2 = ["B", "D", "F", "G", "H", "K"]
def re = CollectionUtils.disjunction(list1, list2)
log.info(re) //[A, C, E, G, H, K]
```text
- CollectionUtils.subtract(list1,list2): Returns the difference between two lists (subtraction)
Example:
```python
def list1 = ["A", "B", "C", "D", "E", "F"]
def list2 = ["B", "D", "F", "G", "H", "K"]
def re = CollectionUtils.subtract(list1, list2)
log.info(re) //[A, C, E]
```text
- CollectionUtils.isEqualCollection(list1,list2): Determines whether two collections are equal
Example:
```python
def list1 = ["A", "B", "C", "D", "E", "F"]
def list2 = ["A", "F", "B", "C", "D", "E"]
def re = CollectionUtils.isEqualCollection(list1, list2)
log.info(re) //true
```text
- CollectionUtils.isSubCollection(list1,list2): Determines whether list1 is a subset of list2
Example:
```python
def list1 = ["A", "F"]
def list2 = ["A", "B", "C", "D", "E", "F"]
def re = CollectionUtils.isSubCollection(list1, list2)
log.info(re) //true
```text
- CollectionUtils.cardinality(str,list1): Returns the number of occurrences of an element
Example:
```python
def list1 = ["A", "A", "A", "D", "E", "F"]
String str = "A"
def re = CollectionUtils.cardinality(str, list1)
log.info(re) //3
```text
## Changelog
| Version | Date | Changes | Author |
| --- | --- | --- | --- |
| v1.0 | 2026-05-20 | Initial version | |
## Background
This document provides detailed information about the CollectionUtils API functionality and usage, helping developers integrate relevant capabilities.
## Applicable Scenarios
Specific applicable scenarios are determined by actual business needs. Developers can select the appropriate API for integration as required.
## Prerequisites
- Access to Fxiaoke Open Platform
- Application authorization and configuration completed
- Basic knowledge of relevant business domain
## Steps
Please refer to the detailed instructions for each API.
## Notes
- Ensure prerequisites are met before calling APIs
- Pay attention to API call frequency limits
- Refer to error code documentation for exception handling
> **Compatibility:** This version currently has no deprecated or compatibility notes.