private void writeCollection(Map<Class<?>, Integer> clazz2count,
			Map<Object, String> object2variableName,
			boolean onlyPropertiesWithMatchingField, Collection<?> collection,
			String collectionName, int maxRecursions, int currentRecursion)
			throws IOException {
		if (maxRecursions == 0 || maxRecursions < currentRecursion) {
			for (Object item : collection) {
				String itemName = writeObject(item, clazz2count,
						object2variableName, onlyPropertiesWithMatchingField,
						maxRecursions, currentRecursion + 1);
				out.write((collectionName + ".add(" + itemName + ");\n")
						.getBytes());
			}
		}
	}