Implements a proper container for indexed (not hashed) scalars.

This fixed a number of performance issues and potential errors in
lookups in dicts and sets of indexed types (such as Enums, Entities and
so on.)

BUG=
R=scudette@gmail.com

Review URL: https://codereview.appspot.com/186110043