• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WHat is this diamond on the class extends?

 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



The posted source code above is the example that I just found, and I felt a bit confused.
1) WHat's that diamond sign means at the front of class name (SC: line: 3rd; SwingWorker< somthing> { ) ...?

2) As I knew the diamond may appeared as a type in a List such as;


I do understand that one. Because that means the variable of myListing is becoming a place where we could put many Image(s) objects. But the diamond at the front of Class extended, what's that??
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15369
40
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The stuff between the angle brackets has to do with generics.

Class SwingWorker is a class that takes type parameters. In your first example, List<Image> is used as the "value" of the first type parameter, and String as the "value" for the second type parameter.

It's really not any different from the second example you posted.
 
venu pokala
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is plain "Generics" concept in Java. I also agree with Jesper de Jong comments.
 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
venu pokala wrote:It is plain "Generics" concept in Java. I also agree with Jesper de Jong comments.


well, so that is a generic, huh? Well okay, okay, i should start reading new chapter ( i guess ), tough.

but hold a sec'

the 3rd line ;



that one seems odd for me. because it is generic inside generic.
If somebody told me two arguments inside the method's args, that's okay... i'm familiar with it.

anyway, thanks for clarifying.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic