Results 1 to 6 of 6
Thread: Generics in java
- 01-23-2009, 06:03 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 30
- Rep Power
- 0
Generics in java
Hi,
I recently started looking into generics (a feature from java 5 onwards). Everything was fine until I somehow came across the Enumeration interface source code:
package java.util;
public interface Enumeration<E> {
boolean hasMoreElements();
E nextElement();
}
What is the 'E' over here ? Any ideas ?
- 01-23-2009, 06:22 AM #2
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
'E' represents the generic type.
- 01-23-2009, 06:36 AM #3
- 01-23-2009, 06:55 AM #4
Member
- Join Date
- Dec 2008
- Posts
- 30
- Rep Power
- 0
I got the idea. Its indeed a dummy variable stating that the Enumeration will contain objects of type E. Thanks to all.
- 01-23-2009, 07:36 AM #5
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
P.S. The developers chose the letter (normally) depending on what they wanted to "say". E normally stands for Element, T Type, K Key, and V Value. Not that that really makes any difference. ;-)
- 01-23-2009, 04:56 PM #6
Similar Threads
-
Question about java generics
By Arrowx7 in forum New To JavaReplies: 1Last Post: 08-14-2008, 02:37 AM -
Java confused over Generics?
By Bibendum in forum New To JavaReplies: 3Last Post: 12-26-2007, 06:23 AM -
Java Generics (an introduction)
By Java Tutorial in forum Java TutorialReplies: 0Last Post: 11-27-2007, 06:50 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks