Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How is that any different from a list?


Two lists are equal only if they have the same contents and in the same order. Bags don’t have an order, they’re more like sets, so bags are equal so long as they have the same contents.


Hopefully this java can illustrate the point if you're not a Java lover

The bag essentially works like this Map<K, Collection<V>>

But looks like this Bag<K, V>

I use my own simple "BagSet" which works like this Map<K, Set<V>>




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: