I tried:
ArrayList<Pelicula> peliculas = YIFY.obtenerPeliculasPorVenir();
being #obtenerPeliculasPorVenir
:
public static List<Pelicula> obtenerPeliculasPorVenir(){
List peliculas = null;
try {
peliculas = mapper.readValue(new API().peticionTexto("http://yts.re/api/upcoming.json"), new TypeReference<List<Pelicula>>(){});
}
catch (IOException excepcion) {
System.out.println(excepcion.getMessage());
}
return peliculas;
}
}
If ArrayList
implements List
why can't I do this?
Is casting the ONLY solution or I should go for another OOP approach?