class foo implements bar {…}

In a quest for a thesis topic, I’ve recently returned to the Wonderful World of Java. I’m poking around to see what opcodes that the JVM consumes look like. The nicest library that I’ve seen for consuming Java bytecodes thus far is bcel, it doesn’t force me to use weird patterns, just a nice easy getInstructions() call on a method object.

I digress. As part of my project, I wanted to create a enumeration that would wrap an array using Java 1.5′s generics. Something that would force the hasMoreElements() and nextElement() calls to return something other than Object. It took 10 minutes of searching to figure out that the syntax is:

class ArrayEnumeration<T> implements Enumeration<T> {
	public ArrayEnumeration(T[] a) {...}
	
	public boolean hasMoreElements() {...}
	public T nextElement() {...}
}

That’s 10 minutes that I’ll never get back.

Reply

You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

If your website is claim enabled, it will be notified that you have posted here.