As others are saying, this is pretty tough to answer without knowing more detail. Since you are considering using a collection to hold all of this data, it sounds like you can't merely process it row-by-row. "Processing the data" requires potentially other data in the table.
That means you need a file-backed DB of some sort. If you don't have access to an ordinary relational database to handle this, then you might consider using a in-memory database such as H2 or JavaDB/Derby. These kinds of databases run in the same VM as your application, but they can use a persistent store to back large tables if you configure accordingly.
* EDIT *
Here is some code which could apply using something like H2. (Exception handling omitted)
Connection connection = DriverManager.getConnection( "jdbc:h2:pruneDB");
Statement stmt = connection.createStatement();
stmt.execute("CREATE TABLE PERSON (USER_ID INT, ITEM_ID INT, BOOK_ID INT )");
stmt.close();
At this point, create a loop which reads your rows of data and insert them into the DB:
while( hasMoreRows() ) {
... read the three IDs you need into variables from your file ...
int bookId = someValueFromTheTextRow;
int userId = someOtherValueFromTheTextRow;
int itemId = yetAnotherValueFromTheTextRow;
// After this, just create a PreparedStatement object, bind your IDs to it, and perform an SQL
// insert into the DB table you created above
}
Once you are out of the loop, you now can use standard SQL to selective delete items from that table.