Alex Rivera | Logout

Java Generics, is <C> equal to <T>?

Asked 2012-03-21T14:39:42.480
21

If I had a Java generic class of...

public class EntityStuff<C> extends AbstractPropertyStuff<C> implements Serializable {

}

Is this the same as...

public class EntityStuff<T> extends AbstractPropertyStuff<T> implements Serializable {

}

does the letter hold any significance?

Edit
Report

1 Answer

2

The T or C is just the identifier for the type parameter, and so those statements are the same.

You can use other, more meaningful, identifiers like TResult or TModelType to make it more expressive and indeed I would encourage you to do so, especially if you have more than one type parameter.

answered 2012-03-21T14:42:51.633

Your Answer