code: public static Map<?, ?> convertToMap(Collection<?> coll, String keyProperty) {
      Map<Object, Object> map = newHashMap();
      for (Object obj : coll) {
        Object key = null;
        try {
          key = PropertyUtils.getProperty(obj, keyProperty);
        } catch (Exception e) {
          Throwables.propagate(e);
        }
        map.put(key, obj);
      }
      return map;
    }
docs: <p>
  convertToMap.
  </p>
  
  @param coll a {@link java.util.Collection} object.
  @param keyProperty a {@link java.lang.String} object.
  @return a {@link java.util.Map} object.