Best way to laod a large file into arraylist in java

Posted by user1730833 on Stack Overflow See other posts from Stack Overflow or by user1730833
Published on 2012-12-17T10:58:15Z Indexed on 2012/12/17 11:03 UTC
Read the original article Hit count: 195

Filed under:

I have a file whose size is about 300mb i want to read the contents line by line and then add it into arraylist. So i have made an object of array list a1 , then reading the file using bufferedreader , after that when i add the lines from file into arraylist it gives an error Exception in thread "main" java.lang.OutOfMemoryError: Java heap space. Please tell me what should be the solution for this.

© Stack Overflow or respective owner

Related posts about java