Why do I get a NullPointerException when I try this:
ArrayList<String> longsToStrings() throws IOException {
LinkedList<Long> longNumbers = populateArrayWithLongs();
ArrayList<String> strings = null;
for (Long l : longNumbers) {
strings.add(l.toString());
}
return strings;
}
When I try to print the results to console, I get NullPointerException. populateArrayWithLongs() function returns array with longs: [1488758722000, 1488773070000, 1488787530000, 1488801890000]