Skip to content
Snippets Groups Projects
Commit e998e161 authored by carmuno's avatar carmuno :tennis:
Browse files

mas cambios

parent c779d9f8
No related branches found
No related tags found
No related merge requests found
File added
package ord_16_17;
import java.util.ArrayList;
import java.util.Collection;
public class Coleccion <E extends Play> {
private ArrayList<E> lista;
private String nombre;
public Coleccion() {
lista = new ArrayList<E>();
}
public void add(E element) {
assert(!lista.contains(element));
lista.add(element);
}
public E get(int pos) {
return lista.get(pos);
}
public void remove(int pos) {
lista.remove(pos);
}
public void playAll() {
lista.stream().forEach(play -> play.Play());
}
public ArrayList<E> getLista(){
return (ArrayList<E>) lista.clone();
}
public Coleccion <E> concatenar(Coleccion<E> collecion){
Coleccion <E> newColeccion = new Coleccion<E>();
for(E play : lista) {
newColeccion.add(play);
}
for(E play : collecion.getLista()) {
newColeccion.add(play);
}
return newColeccion;
}
}
package ord_16_17;
public interface Play {
public void Play();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment