Main - for (int i = 0; i < list.size(); i++)

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.*; i public class Main { p public static void main(String[] args) { MyDLL<String> list = new MyDLL<String>(); M list.add(0, "Tom"); list.addLast("Max"); list.addFirst("John"); list.add(2, "Jack"); list.add(0, "Tim"); list.add(list.size(), "Wenjie"); //list.add(-1, "Drew"); //list.add(2, 5); / System.out.println("Size = " + list.size());
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: for (int i = 0; i &lt; list.size(); i++) System.out.print(list.get(i) + &quot; &quot;); S list.remove(2); list.remove(0); list.remove(list.size() - 1); list.remove(1); System.out.println(&quot;Size = &quot; + list.size()); for (int i = 0; i &lt; list.size(); i++) System.out.print(list.get(i) + &quot; &quot;); S } }...
View Full Document

Ask a homework question - tutors are online