aspose file tools*
The moose likes Java in General and the fly likes WHat is this diamond on the class extends? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "WHat is this diamond on the class extends?" Watch "WHat is this diamond on the class extends?" New topic
Author

WHat is this diamond on the class extends?

J. Insi
Ranch Hand

Joined: Aug 11, 2010
Posts: 90



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

Joined: Aug 16, 2005
Posts: 14347
    
  22

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
venu pokala
Greenhorn

Joined: Jul 07, 2011
Posts: 2
It is plain "Generics" concept in Java. I also agree with Jesper de Jong comments.
J. Insi
Ranch Hand

Joined: Aug 11, 2010
Posts: 90
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: WHat is this diamond on the class extends?