Inspectopedia
 
2024.3

Explicit 'get' or 'set' call

Info
New
Last modified: 03 December 2024

Reports explicit calls to get or set functions which can be replaced by an indexing operator [].

Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the operator modifier:

The functions above correspond to the indexing operator.

Example:

After the quick-fix is applied: