Type parameter naming convention
The official Java type parameter naming convention (https://docs.oracle.com/javase/tutorial/java/generics/types.html) defines the following guidelines for parameter naming:
"By convention, type parameter names are single, uppercase letters. This stands in sharp contrast to the variable naming conventions that you already know about, and with good reason. Without this convention, it would be difficult to tell the difference between a type variable and an ordinary class or interface name. The most commonly used type parameter names are:
- E: Element (used extensively by the Java Collections Framework)
- K: Key
- N: Number
- T: Type
- V: Value
- S,U,V, and so on: 2nd, 3rd, 4th types"
Many classes in the Kotlin standard library follow this convention. It works fine for popular kinds of classes such as common classes (List
,Mat
,Set
, and so on) or classes that define a simple type parameter (the Box<T>
class). However, with custom classes and multiple type parameters, we quickly...