Skip to main content

Lists

Lists are ordered collections that can hold values of any type. They’re similar to arrays in other languages.

Creating Lists

Accessing Elements

Lists use zero-based indexing:

List Methods

List Iteration

Maps

Maps are unordered collections of key-value pairs, similar to dictionaries or objects.

Creating Maps

Accessing Values

Map Methods

Map Iteration

Advanced Patterns

Destructuring

Spread Operations

Collection Utilities

Performance Tips

Pre-allocate Size

When you know the size, pre-allocate for better performance:

Use Appropriate Type

  • Use Lists for ordered data and indexed access
  • Use Maps for key-value lookups
  • Consider Sets for unique values (if available)