code: public static Map<String, Collection<String>> splitDeviceEntities(final Collection<String> entityNames) {
          final Map<String, Collection<String>> result = new HashMap<String, Collection<String>>();
  
          String device;
          String entity;
          for (final String entityName : entityNames) {
              try {
                  final Entry<String, String> deviceEntity = splitDeviceEntity(entityName);
                  if (deviceEntity != null) {
                      device = deviceEntity.getKey();
                      entity = deviceEntity.getValue();
                      if (device != null && entity != null) {
                          Collection<String> attributes = result.get(device);
                          if (attributes == null) {
                              attributes = new HashSet<String>();
                              result.put(device, attributes);
                          }
                          attributes.add(entity);
                      }
                  }
              } catch (final DevFailed e) {
                  // nop
              }
          }
  
          return result;
      }
docs: Splits a collection of entity names and group attributes by device.
  
  @param entityNames a list of entity names to split
  @return a map containing a list of attributes for each device.