How do I converting an ArrayList of strings into a BufferedReader? I'm open to making the ArrayList as an Input Stream instead, but I want an easy way to add strings into the data structure that will eventually be captured by the BufferedReader.
This may not be the quickest or most efficient way, but this is the first thing I thought of:
// Assume the ArrayList is named stringList
StringBuilder buffer = new StringBuilder();
for(String current : stringList) {
buffer.append(current).append("\n");
}
BufferedReader br = new BufferedReader(new StringReader(buffer.toString()));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With