Skip to main content

Description

Combines two lists and returns a new list containing all unique elements from both lists. Duplicates are automatically removed, treating the inputs as sets.

Syntax

Parameters

Returns

Type: list A new list containing all unique elements from both input lists. The order is not guaranteed.

Examples

Example 1: Basic Union

Output:

Example 2: Combining Tags from Multiple Nodes

Example 3: Merging User Interests

Notes

  • Automatically removes duplicates from the result
  • Works with any comparable data types
  • Order of elements in the result is not guaranteed
  • Equivalent to mathematical set union operation
  • Both lists are spread and deduplicated using Set

See Also

Frequently Asked Questions

Yes. The union function combines all input lists and returns only unique elements.
Yes. You can pass multiple lists as arguments to combine them all into a single deduplicated result.