What's the purpose of generics in the following:

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
The_Nick
Posts: 132
Joined: Thu May 16, 2013 9:23 am
Contact:

What's the purpose of generics in the following:

Post by The_Nick »

Hi everyone,

Directly from this java tutorial: http://docs.oracle.com/javase/tutorial/ ... /dirs.html

Code: Select all

DirectoryStream.Filter<Path> filter =
    newDirectoryStream.Filter<Path>() {
I mean I thouroughly understand generics... however in this example it is unclear to me why it has been "genericsized".

Furthermore also in the Walking File Tree operation we have to implement FileVisitor which is genericsized too.. I mean, it will be used only for path object.. why not put directly in the parameners a Path placeholder?
Is there something I am missing about generics?
Could you please give me some insights about it?
Thanks in advance.

The_Nick.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests