Why are generics called generics?

后端 未结 9 868
野性不改
野性不改 2021-02-04 00:48

At the risk of becoming the village idiot, can someone explain to me why generics are called generics? I understand their usage and benefits, but if the definition of generic i

9条回答
  •  灰色年华
    2021-02-04 01:35

    If they called it "type parameter(s)" people would confuse it with parameters of type Type.

    Also, ArrayList isn't "generic". It ONLY works with types of object. If you ask it for something, it will give you an object reference. That's a very specific behavior.

提交回复
热议问题