Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- /**
- * Write a description of class Ejericio here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class Ejericio
- {
- /**
- *Metodo que concatena en un ArrayList
- *dos arrays distintos y retorna un ArrayList
- */
- public ArrayList<String>componerLista(String[]nombre,int []cantidad){
- ArrayList<String> list=new ArrayList<String>();
- for(int i=0;i<nombre.length;i++){
- //variable temporal que guarda la concatenacion
- String temporal=nombre[i]+" "+cantidad[i];
- list.add(i,temporal);//añade al ArrayList la concatenacion
- }
- return list;
- }
- }
Add Comment
Please, Sign In to add comment