G
gmail.5.mbrna
hi. I'm attempting to learn some java. Currently following the
Collections Trail
at http://java.sun.com/docs/books/tutorial/collections/index.html
On this page
http://java.sun.com/docs/books/tutorial/collections/interfaces/list.html
is an example of sublisting:
public static <E> List<E> dealHand(List<E> deck, int n) {
int deckSize = deck.size();
List<E> handView = deck.subList(deckSize - n, deckSize);
List<E> hand = new ArrayList<E>(handView);
handView.clear();
return hand;
}
When I paste that into a file and try to compile with javac, I get
'class' or 'interface' expected
public static <E> List<E> dealHand(List<E> deck, int n)
--------------^
(the carat is pointing to the first < char on the line)
javac -version reports: javac 1.5.0_07
What am I doing wrong?
thanks,
mikey.
Collections Trail
at http://java.sun.com/docs/books/tutorial/collections/index.html
On this page
http://java.sun.com/docs/books/tutorial/collections/interfaces/list.html
is an example of sublisting:
public static <E> List<E> dealHand(List<E> deck, int n) {
int deckSize = deck.size();
List<E> handView = deck.subList(deckSize - n, deckSize);
List<E> hand = new ArrayList<E>(handView);
handView.clear();
return hand;
}
When I paste that into a file and try to compile with javac, I get
'class' or 'interface' expected
public static <E> List<E> dealHand(List<E> deck, int n)
--------------^
(the carat is pointing to the first < char on the line)
javac -version reports: javac 1.5.0_07
What am I doing wrong?
thanks,
mikey.