import java.util.*; class UseArrayLists5 // Shows adding an integer after all occurrences of an integer // destructively in an ArrayList. // Corrected to deal with the two integers being the same. { public static void main(String[] args) throws Exception { Scanner input = new Scanner(System.in); System.out.println("Enter some numbers (all on one line, separated by spaces):"); String line = input.nextLine(); String[] numbers = line.split(" "); ArrayList a = new ArrayList(); for(int i=0; i a,int m,int n) // Adds n after every occurrence of m in a, destructively { for(int i=0; i