class_name ArrayTool static func removeAll(array: Array, value) -> Array: var result = [] for item in array: if item != value: result.append(item) return result static func swap(array: Array, a: int, b: int): var temp = array[a] array[a] = array[b] array[b] = temp return array static func parseEncodedObject(arr: Array) -> Array: var result = [] for item in arr: if item is EncodedObjectAsID: result.append(instance_from_id(item.get_instance_id())) else: result.append(item) return result static func betterMap(arr: Array, executor: Callable) -> Array: var result = [] for index in len(arr): result.append(executor.call(arr[index], index, arr)) return result static func fill(origin: Dictionary, filler: Callable) -> Dictionary: return origin.keys().reduce( func(accum, key): accum[key] = filler.call(key) return accum, {} ) static func dictionaryFromEntries(keys: Array, values: Array) -> Dictionary: var result = {} for index in len(keys): var key = keys[index] var value = values[index] result[key] = value return result static func mergeDictionary(a: Dictionary, b: Dictionary) -> Dictionary: var result := {} for key in a: result[key] = a[key] for key in b: result[key] = result.get(key, 0.0) + b[key] return result