I am currently new to working with Java. So far I have been able to easily use the basic such as Classes
, Functions
, Arrays
etc from my knowledge of JavaScript and PHP.
However, what I have never seen before is this: <>
. Inside of that is a variable of some type. Because I don't know what it is called, I can't find any answers.
I've seen them like this:
List<String> myList = new ArrayList<String>();
But also like:
public static <T> boolean contains( final T[] array, final T v ) {
for ( final T e : array )
if ( e == v || v != null && v.equals( e ) )
return true;
return false;
}
What does the <String>
mean?
In the function, I was also wondering what is specifically special about the T
?