新随笔  :: 订阅 订阅  :: 管理

API文档中,<E>、<T>、<?>分别代表什么意思

Posted on 2014-06-05 17:51  redcoatjk  阅读(836)  评论(0编辑  收藏  举报

although they are all type parameters, the convention is:
E Element
T or S Type
K Key, as in <K, V>
V Value

? is the wildcard.

I guess this is mentioned in the API doc... looking for it...
Java Tutorial, Using Generic Types
http://java.sun.com/docs/books/tutorial/java/javaOO/gentypes.html

Type Parameter Conventions
You have already seen the angle bracket and single letter notation used to 
represent a type parameter. By convention, a type parameter is a single, 
uppercase letter — this allows easy identification and distinguishes a type 
parameter from a class name. The most common type parameters you will see are:

* <T> — Type
* <S> — for Type, when T is already in use
* <E> — Element (used extensively by the Java Collections Framework)
* <K> — Key
* <V> — Value
* <N> — Number