# Component arrays vs. entity structs? [closed]

Two of the main systems I've seen in entity system tutorials are:

• An Entities class with one array / [hash]map for each component, with indices corresponding to entity IDs.
• A list of Entity structs, which have the components as fields, and possibly a pointer to a "cold" struct for less used components.

What are the reasons I would use the former over the latter, considering that the latter seems much easier to implement? Is there some advantage to having each attribute laid out contiguously in memory?