ee.List.cat
Concatenates the contents of other onto list.
Usage | Returns |
---|
List.cat(other) | List |
Argument | Type | Details |
---|
this: list | List | |
other | List | |
Examples
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]
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
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]
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`List.cat()` combines the elements of two lists into a new, single list, preserving the original order of elements."],["It accepts two arguments: the initial list (`this`) and the list to append (`other`), both of type `List`."],["The function returns a new `List` containing all elements from both input lists."],["`List.cat()` handles empty lists gracefully, returning the non-empty list if one is empty, or an empty list if both are empty."]]],["The `List.cat(other)` function concatenates the elements of one list (`other`) onto another list (`list`). It returns a new `List` object containing all elements. The function works with various data types, including strings, numbers, and nested lists. If either list is empty, the function returns the other list. If both are empty, it returns an empty list. `getInfo()` can be used to return the contents of the list.\n"]]