findMap

Execute the query returning a map of the objects.

We use asMapKey() to specify the property to be used as keys on the map.

// map keyed by sku

Map<String, Product> map =
    new QProduct()
     .sku.asMapKey()
     .findMap();

If the map key property is not specified on the query then the id property is used.

// map keyed by Id property
// ... when map key property not defined

Map<Long, Product> map =
    new QProduct()
      .findMap();