Object (@NotNull Object object, @Nullable Object context, @Nullable SerializationFilter filter) { Collection<?> collection = getIterable(object); String tagName = isSurroundWithTag() ? getCollectionTagName(object) : null; if (tagName == null) { List<Object> result = new SmartList<>(); if (!collection.isEmpty()) { for (Object item : collection) { ContainerUtil.addAllNotNull(result, serializeItem(item, result, filter)); } } return result; } else { Element result = new Element(tagName); if (!collection.isEmpty()) { for (Object item : collection) { Content child = (Content)serializeItem(item, result, filter); if (child != null) { result.addContent(child); } } } return result; } }