Indexed Access Operator and Augmented Assignments

Learn how to access elements in collections using [] brackets and get methods, and explore augmented assignments for modifying variables and collections.

The indexed access operator

In programming, there are two popular conventions for getting or setting elements in collections.

  • The first uses [] brackets

  • The second uses the get and set methods

In Java, we use the first convention for arrays and the second one for other kinds of collections. In Kotlin, both conventions can be used interchangeably because the get and set methods are operators that can be used with [] brackets.

Get hands-on with 1200+ tech skills courses.