Is it possible to read a text file with a double while/for loop? 

I'd like to do something like this:

```
for( String row1 = 0; row1 < file.length; row1++ ) {

   for( String row2 = row1 + 1; row2 < file.length; row2++ ){

       if( file[row1] == file[row2] ){
            // other code
       }

   }

}

```

I need a double loop because I have to find a duplicate row in the file with 2.500.000 rows.
I can't use a Set to save the rows because the heap size is insufficient and if I try to increase it, I get this error: "Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.." (I've got a Windows 7 64 bit and 8 GB Ram)

Thanks in advance