Alle Artikel der 'Scala' Kategorie

Closures in Java and Scala

People argue that verbose code is easier to understand. Do you agree when reading these two? public List<Item> bought(User user) { List<Item> result = new ArrayList(); for (Item item : currentItems) { if (user.bought(item)) { result.add(item); } } return result; } def bought(user: User): List[Item] = { items.filter(user bought _) } If you are familiar […]