Guest User

Untitled

a guest
May 25th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. /**
  3.  * Write a description of class Ejericio here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class Ejericio
  9. {
  10.     /**
  11.      *Metodo que concatena en un ArrayList
  12.      *dos arrays distintos y retorna un ArrayList
  13.      */
  14.     public ArrayList<String>componerLista(String[]nombre,int []cantidad){
  15.        
  16.         ArrayList<String> list=new ArrayList<String>();
  17.         for(int i=0;i<nombre.length;i++){
  18.              //variable temporal que guarda la concatenacion
  19.             String temporal=nombre[i]+" "+cantidad[i];
  20.             list.add(i,temporal);//añade al ArrayList la concatenacion
  21.         }
  22.        
  23.         return list;  
  24.     }
  25. }
Add Comment
Please, Sign In to add comment