ClosedLab11a author version 20141010 import java util ArrayList import java util Scanner public class Lab11a public static void main String args Scanner sc new Scanner System in System out println Enter the first wordlist ArrayList String list1 getList sc System out println nEnter the second wordlist ArrayList String list2 getList sc System out println nWordlist 1 n displayList list1 System out println nWordlist 2 n displayList list2 System out println nList 2 appended to the end of List 1 n displayList appendLists list1 list2 System out println nList 1 appended to the end of List 2 n displayList appendLists list2 list1 private static ArrayList String getList Scanner inScanner ArrayList String list new ArrayList String while true String word System out print Enter a word XXX to quit word inScanner next if word equals xxx word equals XXX break else list add word return list private static void displayList ArrayList String myList int i int len myList size for i 0 i len i System out println i myList get i private static ArrayList String appendLists ArrayList String list1 ArrayList String list2 ArrayList String appendedList new ArrayList String int i len1 list1 size len2 list2 size for i 0 i len1 i appendedList add list1 get i for i 0 i len2 i appendedList add list2 get i return appendedList
View Full Document