In terms of performance and memory, which would be the most efficient?
Right now, I have a List<ArrayList<String>> that holds almost 200,000 records, generated by a separate business logic. I am trying to print it in a table format in a HTML page using Thymeleaf.
Currently, I am using nested th:each loop to print the data with th:text. As expected, this takes a long time.
I looked into this and found that th:utext can be used to print html content in Thymeleaf.
My business logic to generate these 200,000 records, currently gives a List<ArrayList<String>> object, but I can modify it to a List<String> object by making changes.
My question, however, is that, will that be more memory-efficient. It is very much possible that it will be more performance efficient, but my main concern is memory-efficiency. Would a List<ArrayList<String>> take up the same amount of memory as a List<String> containing the same data ? (By same data, I mean, the content is the same - instead of an ArrayList<String>, it's going to contain a single string with HTML elements in between). Or would it take up more memory?
I am relatively new to understanding space complexity of data structures; hence the query.