I have to make an application that manages the billboard of a cinema.I have a standard data that contains, among other data, the title of the movie. I also have a session type data that contains int capacity, localtime time, localdate date and the movie. I have to make a method that eliminates the session passing as parameters the title of the movie, the date and the time of the session. The method fails me in the if inside the for. I do not know what I'm doing wrong. Could it be because of how I compare data of type localdata and local time?
public boolean quitarSesion(String tituloEliminar, LocalDate fechaEliminar, LocalTime horaEliminar)
{
int count=0;
for(Sesion sesion: sesiones){
if(sesion.pelicula.titulo==tituloEliminar && sesion.fecha==fechaEliminar && sesion.hora==horaEliminar){
sesiones.remove(sesion);
System.out.println("Sesion eliminada correctamente");
count++;
}
if(count==0){
System.out.println("No se ha eliminado ninguna sesion");
return false;
}
else{
System.out.println("Sesion eliminada correctamente");
return true;
}
}