indexBy, which indexes a collection into a hashtable