for (@SuppressWarnings("rawtypes") Map.Entry<AttributeSensor, Object> entry : allAttributes.entrySet()) { AttributeSensor<?> key = checkNotNull(entry.getKey(), allAttributes); if (key.getPersistenceMode() != SensorPersistenceMode.NONE) { Object value = entry.getValue(); builder.attributes.put(key, value);