javajavap

Angular braces notation for types resulted by javap


In java profiler command output, I've been seeing these notations in angular braces like

java.util.Queue<E>
java.util.TreeMap<K, V>

Correct me if I'm wrong; working through some exercises, I've been able to relate E-Entity, K,V - Key-Value pair. I've seen others like java.lang.Iterable<T>, for which I couldn't figure out what T is for.

Can someone help me in telling what these notations are called and how many such exist in Java SE?


Solution

  • They’re called generics. They allow a method/class/interface etc. to operate on multiple types of Object (e.g. Integer, String) without compromising type checking.

    See: