Reputation: 15844
Is it possible to make something like this? I know that implements cannot be in the <>, but I want to restrict the T to be Serializable somehow.
implements
public class Clazz<T implements Serializable> { ... }
Upvotes: 21
Views: 9861
Reputation: 80633
Yes, just use extends instead of implements.
extends
Upvotes: 4
Reputation: 39194
public class Clazz<T extends Serializable> { ... }
Upvotes: 32
Reputation: 36339
Just use extends instead of implements.
Upvotes: 6