The Daily WTF
It’s weird to call Java’s streams a “new” feature at this point, but given Java’s prevalence in the “enterprise” space, it’s not surprising that people are still learning how to incorporate them into their software. We’ve seen bad uses of streams before, notably thanks to Frenk, and his disciple Grenk.
Well, one of Antonio‘s other co-workers “learned” their lesson from Frenk and Grenk. Well, they learned a lesson, anyway. That lesson was “don’t, under any circumstances, use streams”.
Unfortunately, they were so against streams, they also forgot about basic things, like how lists and for-loops work, and created this:
private List<Integer> createListOfDays(String monthAndYear) { List<Integer> daysToRet = new ArrayList<>(); Integer daysInMonth = DateUtils.daysInMonth(monthAndYear); for (Integer i = 1; i <= daysInMonth; i++) { daysToRet.add(i); } Set<Integer> dedupeCustomers = new LinkedHashSet<>(daysToRet); daysToRet.clear(); daysToRet.addAll(dedupeCustomers); Collections.sort(daysToRet); return daysToRet; }
The goal of this method is, given a month, it returns a
To read the full article click on the 'post' link at the top.