write a collection
344593
private void writeElements(SerIterator itemIterator) throws IOException {
        if (itemIterator.metaTypeRequired()) {
            output.writeObjectStart();
            output.writeObjectKeyValue(META, itemIterator.metaTypeName());
            output.writeObjectKey(VALUE);
        }
        if (itemIterator.category() == SerCategory.MAP) {
            writeMap(itemIterator);
        } else if (itemIterator.category() == SerCategory.COUNTED) {
            writeCounted(itemIterator);
        } else if (itemIterator.category() == SerCategory.TABLE) {
            writeTable(itemIterator);
        } else if (itemIterator.category() == SerCategory.GRID) {
            writeGrid(itemIterator);
        } else {
            writeArray(itemIterator);
        }
        if (itemIterator.metaTypeRequired()) {
            output.writeObjectEnd();
        }
    }
407919
function collection$$1(eles, opts) {
    if (string(eles)) {
      return this.$(eles);
    } else if (elementOrCollection(eles)) {
      return eles.collection();
    } else if (array(eles)) {
      return new Collection(this, eles, opts);
    }

    return new Collection(this);
  }
186819
public static <T> Collection<T> notEmpty(Collection<T> list, String name) {
        notNull(list, name);
        if (list.isEmpty()) {
            throw new IllegalArgumentException(String.format("Collection %s is empty", name));
        }
        return list;
    }
865327
def write_collection_info(self, collection: BioCCollection):
        
        elem = etree.Element('source')
        elem.text = collection.source
        self.__writer.send(elem)

        elem = etree.Element('date')
        elem.text = collection.date
        self.__writer.send(elem)

        elem = etree.Element('key')
        elem.text = collection.key
        self.__writer.send(elem)

        for k, v in collection.infons.items():
            elem = etree.Element('infon', {'key': str(k)})
            elem.text = str(v)
            self.__writer.send(elem)
714410
public void writeBeginCollectionInfo(BioCCollection collection)
      throws XMLStreamException {

    if (hasWrittenCollectionInfo) {
      throw new IllegalStateException(
          "writeCollectionInfo can only be invoked once.");
    }

    hasWrittenCollectionInfo = true;

    writer
        .writeStartDocument(
            collection.getEncoding(),
            collection.getVersion(),
            collection.isStandalone())
        .writeBeginCollectionInfo(collection);
  }
821857
private void appendList(Output out, Collection collection, String separator, boolean areColumns) {
        Iterator it = collection.iterator();
        boolean hasNext = it.hasNext();
        //boolean areColumns = (columns == collection);

        while (hasNext) {
            Outputable sqlToken = (Outputable) it.next();
            hasNext = it.hasNext();
            sqlToken.write(out);
            if (areColumns) {
                Column column = (Column) sqlToken;
                String columnAlias = column.getAlias();
                if (columnAlias != null) {
                    out.print(" AS ");
                    out.print("\"");
                    out.print(columnAlias);
                    out.print("\"");
                }
            }
            if (hasNext) {
                out.print(separator);
                out.println();
            }
        }
    }
116420
def filter(self, collection, data, **kwargs):
        """"""
        ops = self.parse(data)
        collection = self.apply(collection, ops, **kwargs)
        return ops, collection
940023
def write_collection_from_tmpfile(self, collection_id, tmpfi, parent_sha, auth_info, commit_msg=''):
        
        return self.write_doc_from_tmpfile(collection_id,
                                           tmpfi,
                                           parent_sha,
                                           auth_info,
                                           commit_msg,
                                           doctype_display_name="collection")
267639
function walkCollections(patterns, drizzleData, writePromises = []) {
  if (hasCollection(patterns)) {
    writePromises.push(
      writePage(
        patterns.collection.id,
        patterns.collection,
        drizzleData.options.dest.patterns,
        drizzleData.options.keys.collections.plural
      )
    );
  }
  for (const patternKey in patterns) {
    if (!isCollection(patterns[patternKey])) {
      walkCollections(patterns[patternKey], drizzleData, writePromises);
    }
  }
  return writePromises;
}
73405
function(ferret, collection_name, callback) {
    _ready(ferret, function(err) {
        if (err) {
            process.nextTick(function() {
                callback(err)  
            })
        } else {
            if (ferret._collections[collection_name]) {
                process.nextTick(function() {
                    callback(null, ferret._collections[collection_name])
                })
            } else {
                ferret._db.collection(collection_name, function(err, collection){
                    if (!err) { ferret._collections[collection_name] = collection }
                    callback(err, collection)
                })
            }
        }
    })
}
259572
def dump(collection: BioCCollection, fp, pretty_print: bool = True):
    
    fp.write(dumps(collection, pretty_print))
727717
def collection(*params, &parser)
      LazyCollection.new(
        @client,
        host,
        path,
        merged_params(*params),
        &parser
      )
    end
554955
def write(self, output_io):
        ''''''
        for name, tax in self.taxonomy.items():
            output_io.write("%s\t%s\n" % (name, '; '.join(tax)))
631674
def apply(self, collection, data):
        """"""
        value = self.value(data)
        if value is self.default:
            return collection
        return [o for o in collection if getattr(o, self.name, None) == value]
1003723
function Collection(options) {
  Base.call(this, options);
  this.define('lists', {});
  this.define('_items', {});
  this.define('Item', this.options.Item || require('./item'));
  this.define('List', this.options.List || require('./list'));
  mixins(this);

  /**
   * Get an object representing the current items on the instance.
   *
   * ```js
   * var items = this.items;
   * ```
   *
   * @return {Object} Object of items
   */

  Object.defineProperty(this, 'items', {
    enumerable: false,
    configurable: true,
    get: function () {
      return this._items;
    },
    set: function (items) {
      lazy.forIn(items, function (item, key) {
        delete this._items[key];
        delete this[key];
        this.set(key, item);
      }, this);
    }
  });
}
332660
function(collection){
		var self = this;
        if( !is.Array(collection) ){
            this.colors.push(collection);
        } else {
            each(collection,function(color){
                self.colors.push(color);
            });
        }
		return this;
	}
964755
@Deprecated
	public <T> byte[] writeObjectCollection(Iterable<T> objects) throws JsonProcessingException, IllegalAccessException {
		try {
			return writeDocumentCollection(new JSONAPIDocument<>(objects));
		} catch (DocumentSerializationException e) {
			if (e.getCause() instanceof JsonProcessingException) {
				throw (JsonProcessingException) e.getCause();
			} else if (e.getCause() instanceof  IllegalAccessException) {
				throw (IllegalAccessException) e.getCause();
			}
			throw new RuntimeException(e.getCause());
		}
	}