I want to delete/remove an object from an array list of objects. Would this work if my class was:
class bookings {
public String getuser () {
return user;
}
public Date getbooking() {
return bookingDate;
}
private String user;
private Date bookingDate;
}
and I had an arraylist similar to:
ArrayList <bookings> book;
public void foo (String user, Date date) {
for (bookings b : book) {
if (user.equals(b.getuser()) && date.equals(g.getbooking()) book.remove(b);
}
}
system.out.println(b.getUser())