private static @NotNull List<? extends Attribute> getNotEmptyAttributes(@NotNull List<? extends Attribute> list) {
    if (list.isEmpty()) {
      return Collections.emptyList();
    }

    List<Attribute> result = null;
    for (Attribute attribute : list) {
      String s = attribute.getValue();
      if (s != null && !s.isEmpty()) {
        if (result == null) {
          result = new ArrayList<>(list.size());
        }
        result.add(attribute);
      }
    }
    return result == null ? Collections.emptyList() : result;
  }
private static @NotNull List<? extends Attribute> getNotEmptyAttributes(@NotNull List<? extends Attribute> list)