I have a question about Java Generics. If I define a class like this:
public Test<String> ...
Does this mean that my class now acts like a collection type for Strings? For example when seeing it like this List I know that it is a List of Strings. Does the <> always mean it’s a collection (general meaning, not the actual Collection type)?
thanks,
No. It just means that your type is parameterized with the type String. There are plenty of non-collection generic types. See
Callable<T>,Future<T>,Comparator<T>for example.