ArrayList<E>.from constructor

ArrayList<E>.from(
  1. Iterable<E> collection
)

Creates an ArrayList from an existing collection.

collection the collection to copy from

A resizable array implementation similar to Java's ArrayList.

This class provides a dynamic array that can grow and shrink as needed, with methods similar to Java's ArrayList.

Example usage:

ArrayList<String> list = ArrayList<String>();
list.add("Hello");
list.add("World");
list.insert(1, "Beautiful");

print(list.get(0)); // "Hello"
print(list.size()); // 3

Implementation

ArrayList.from(Iterable<E> collection) : _list = List<E>.from(collection);