I have an ArrayList whose output is given as:
[, bd33b056-7a24-490f-a4bb-88cb2687facb%1514759804437%New York, USA%Florida, USA%2018-01-01%2018-01-10%UM-66%3050.0, bd33b056-7a24-490f-a4bb-88cb2687facb%1514759837907%New York, USA%California, USA%2018-01-01%2018-01-10%UM-66%8770.0]
Now I am creating a method to have a string id as parameter, when ever is matches with the id of booking it will remove that index. The id is after first %, is there any way to find out index of that specific booking? Here is method
public static void removeElement(String id) throws FileNotFoundException, IOException{
BufferedReader b = new BufferedReader(new FileReader("Booking.dat"));
String d = b.readLine();
String[] allB = d.split("£");
ArrayList<String> data = new ArrayList<String>(Arrays.asList(allB));
data.remove(id);// need to have specific index of id inside the full arraylist
System.out.println(data);
}