In-place map for MutableCollection

This is debatable. The API guidelines specify:

When the operation is naturally described by a noun, use the noun for the nonmutating method and apply the “form” prefix to name its mutating counterpart.

This convention addressed union and intersection, which lack non-awkward verb forms in English. However, “map,” “filter,” and “remove” can all be used as verbs.

Contra extending the confusing, easily misread formFoo convention (looks like “from foo”), consider:

  • filterInPlace
  • mapInPlace

…versus:

  • formFilter
  • formMap

The latter both imply that we are creating a filter or a map, not applying one. Forcing these words that can be verbs to instead function as nouns makes them misleading.

4 Likes