Skip to content

Instantly share code, notes, and snippets.

@likwid
Created December 21, 2013 05:15
Show Gist options
  • Save likwid/8065715 to your computer and use it in GitHub Desktop.
Save likwid/8065715 to your computer and use it in GitHub Desktop.
Java:
public List<Item> bought(User user)
{
List<Item> result = new ArrayList();
for (Item item : currentItems)
{
if (user.bought(item))
{
result.add(item);
}
}
return result;
}
Scala:
def bought(user: User) = items.filter(user bought _)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment