First, check out this document first:
http://htmlcleaner.sourceforge.net/doc/org/htmlcleaner/TagNode.html
It have a function called:
getAllElementsList(boolean isRecursive).
and it will return me something called:
List
Ok, when I go to this the document of “List”, I check this:
http://download.oracle.com/javase/1.5.0/docs/api/java/util/List.html
Which is an interface:
public interface List<E> extends Collection<E>
My question is….What does it expand me to do? He want me to have an object which implemented the List interface can get be used as a return type?
Also, what is the <E> means? Thank you.
Yes, you need to return anything that implements
List<E>, e.g.ArrayList<E>orLinkedList<E>.The
<E>is a generic type, i.e. you can replace it with a concrete class or interface, e.g.List<Integer>to define the list to contain Integer objects only.Note that
ListandList<E>are different, with generic type checking being disabled for the former. If the method has the return typeListit’s most probably old code or for compatibility reasons with Java prior to 1.5. Nowadays you’d most probably useList<?>as the return type if that wouldn’t matter.