AI-generated Key Takeaways
-
The
List.cat(other)method concatenates the contents of another list onto the end of the current list. -
Both the
thislist and theotherlist must be of typeList. -
The method returns a new
Listcontaining the concatenated elements. -
Examples demonstrate concatenating lists with various elements, including nested lists and empty lists.
| Usage | Returns |
|---|---|
List.cat(other) | List |
| Argument | Type | Details |
|---|---|---|
this: list | List | |
other | List |
Examples
Code Editor (JavaScript)
print(ee.List(['dog']).cat(['squirrel'])); // ["dog","squirrel"] print(ee.List(['moose']).cat(['&', 'squirrel'])); // ["moose","&","squirrel"] print(ee.List([['a', 'b']]).cat(ee.List([['1', 1]]))); // [["a","b"],["1",1]] print(ee.List([]).cat(ee.List([]))); // [] print(ee.List([1]).cat(ee.List([]))); // [1] print(ee.List([]).cat(ee.List([2]))); // [2]
import ee import geemap.core as geemap
Colab (Python)
print(ee.List(['dog']).cat(['squirrel']).getInfo()) # ['dog', 'squirrel'] # ['moose', '&', 'squirrel'] print(ee.List(['moose']).cat(['&', 'squirrel']).getInfo()) # [['a', 'b'], ['1', 1]] print(ee.List([['a', 'b']]).cat(ee.List([['1', 1]])).getInfo()) print(ee.List([]).cat(ee.List([])).getInfo()) # [] print(ee.List([1]).cat(ee.List([])).getInfo()) # [1] print(ee.List([]).cat(ee.List([2])).getInfo()) # [2]