java Out of heap memory
I have a code that have like 10 ArrayList with the type of string ( we have to find the intersection , Union , Complement of sets , Difference , symmetric difference and Cartesian product , and power set of 2 sets)

So I did like  10 different array List and I ran into this error.
 
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Is there a way to reduce the memory usage 
java Out of heap memory
===

I have a code that have like 10 ArrayList with the type of string ( we have to find the intersection , Union , Complement of sets , Difference , symmetric difference and Cartesian product , and power set of 2 sets)

So I did like  10 different array List and I ran into this error.
 
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Is there a way to reduce the memory usage 