Is it possible to find the present index in an enhanced for loop? If so how?
I am aware we can check it with an extra variable. But is there any other way.
public boolean cancelTicket(Flight f, Customer c) {
    List<BookingDetails> l = c.getBooking();
    if (l.size() < 0) {
        return false;
    } else {
        for (BookingDetails bd : l) {
            if(bd.getFlight()==f){
                l.remove()  // Index here..
            }
        }
    }
}
 
     
     
     
    