Constructs a union type. If the types sets contains another Union type it's flattened. Duplicates are removed. If types set contains Object type it's simplified to Object type. If the set contains a single element, it is returned instead of constructing a union. @throws IllegalArgumentExcep
(StarlarkType... types)
| 349 | * @throws IllegalArgumentException If an empty set is passed in. |
| 350 | */ |
| 351 | public static StarlarkType union(StarlarkType... types) { |
| 352 | return union(ImmutableSet.copyOf(types)); |
| 353 | } |
| 354 | |
| 355 | /** Constructs a union type. */ |
| 356 | public static StarlarkType union(ImmutableSet<StarlarkType> types) { |