Avoid possible bugs with addAll on function parameter