How to link collections list to file handling?

Viewed 12

Below, on removing a file, item is still displayed in the list. isn’t the item should also be removed from list

    for(int i=0;i<objr;i++) { 
        String item = input1.nextLine();
        Files.deleteIfExists(Paths.get("D:\\Shanth\\example\\"+item + ".txt"));         
    } 
    System.out.println(al)

the target is if I remove the file, the element should also removed from the list without using any collection remove function. is this possible

0 Answers
Related