• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is this line mean:

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
public class DelayQueue<E extends Delayed>

what the <> does?
and where can i read about it?

thanks
 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Check this.

Best of luck ...
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Vassili pointed out, the <> are used in Generics, a language addition in Java version 1.5. It essentially allows the developer to create type declarations. I have found this especially helpful in the Collections framework. For example before 1.5 you might do something like the following:



Notice that I have to cast the return object from an Object to an Item. In Java 1.5 and later you can declare a list of a specific type:



See how you don't need to cast from an Object to an Item. And it also prevents non-Item type objects from being added to the list. Type safety is generally increased.

You might also check out the following tutorial: tutorial.

Dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic