I'm trying to figure out how to delete a specific line in my Arraylist when a user types in a book ID number. However it seems that it can't find that ID number anywhere in my Arraylist.
private void removeBook() 
    // Removes a certain book from the Book List.
    {
        Scanner IDS = setbookID();
        int idNum = IDS.nextInt();
        if(bookList.contains(idNum)){ //problem
            bookList.remove("B"+Integer.valueOf(idNum));
        }
    }
private Scanner setbookID(){
    Scanner bookID = new Scanner(System.in);
    System.out.println("Enter your book's ID number. ");
    return bookID;}
bookList is an ArrayList that read through a text file and come out as a String. A line in my text file looks like this:
B998 ; Aithiopika ; Heliodorus ; 1829
However if the user types in "998" it doesn't remove this line from the ArrayList. Any ideas on how I can go about doing this? Would an iterator somewhat help?
EDIT: This is how I added the books to the ArrayList in the first place.
private ArrayList<Book> readBooks(String filename) {
        ArrayList<Book> lines = new ArrayList<>();
        readTextFileB(filename, lines);
        return lines; 
    }
private void readTextFileB(String filename, ArrayList<Book> lines) 
    // Reads the books.txt file.
    {
        Scanner s = null;
        File infile = new File(filename);
        try{
            FileInputStream fis = new FileInputStream(infile);
            s = new Scanner(fis);
        } catch (FileNotFoundException e){
            e.printStackTrace();
        }
        while(s.hasNextLine())
            lines.add(new Book(s.nextLine()));
    }