Java Reference
In-Depth Information
removeLast
java. util.List<E>
listIterator
java. util.ListIterator<E>
add
hasPrevious
previous
set
REVIEW EXERCISES
΢ Exercise R15.1. Explain what the following code prints. Draw pictures of
the linked list after each step. Just draw the forward links, as in Figure 1 .
LinkedList<String> staff = new
LinkedList<String>();
staff.addfirst(ÐHarryÑ);
staff .addfirst(ÐDickÑ);
staff.addfirst(ÐTomÑ);
System.out.println(staff. removefirst());
System.out.println(staff.removefirst());
System.out.println(staff.removefirst());
΢ Exercise R15.2. Explain what the following code prints. Draw pictures of
the linked list after each step. Just draw the forward links, as in Figure 1 .
LinkedList<String> staff = new
LinkedList<String>;();
staff.addfirst(ÐHarryÑ);
staff .addFirst(ÐDickÑ);
staff.addfirst(ÐTomÑ);
System.out.println (staff.removeLast());
System.out.println(staff.removeFirst());
System.out.println(staff.removeLast());
691
692
΢ Exercise R15.3. Explain what the following code prints. Draw pictures of
the linked list after each step. Just draw the forward links, as in Figure 1 .
LinkedList<String> staff = new
LinkedList<String>();
staff.addfirst(ÐHarryÑ);
staff.addLast(ÐDickÑ);
staff.addfirst(ÐTomÑ);
System.out.println(staff.removeLast());
Search WWH ::




Custom Search