Advertisement
lamiastella

CS367_hw1_6.java

Jun 20th, 2014
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. /* File name : HW1_6 */
  2. import java.util.*;
  3. public class hw1_6 {
  4.  
  5.    public static List<Integer> whatIsThisFunction(List<Integer> src, List<Integer> dst){
  6.        while (!src.isEmpty()) {
  7.              dst.add(dst.size(), src.remove(0));
  8.         }
  9.      return dst;
  10.    }
  11.  
  12.  
  13.  
  14.    public static void main(String args[]){
  15.        
  16.        
  17.        List<Integer> src = new ArrayList<Integer>();
  18.        src.add(1);
  19.        src.add(2);
  20.        src.add(3);
  21.        src.add(4);
  22.        List<Integer> dst = new ArrayList<Integer>();
  23.        dst.add(9);
  24.        dst.add(7);
  25.        dst.add(22);
  26.        List<Integer> result = whatIsThisFunction(src,dst);
  27.        
  28.        System.out.println(result);
  29.    
  30.    }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement