<commit_before>part of discord;

/// A collection of objects, easily searchable.
class Collection<T> {
  /// The collection's internal map of objects.
  Map<String, dynamic> map = <String, dynamic>{};

  /// The list of objects in the collection.
  List<dynamic> get list => this.map.values.toList();

  /// The size of the collection.
  int get size => this.map.length;

  /// The first element.
  dynamic get first => this.list.first;

  /// The last element.
  dynamic get last => this.list.last;

  /// Gets a item by it's key.
  dynamic operator [](String key) => this.map[key];

  /// Adds a value to a collection.
  void add(dynamic value) {
    this.map[value.id] = value;
  }

  /// Finds a single item where `item.property == value`.
  dynamic find(String property, dynamic value) {
    for (dynamic o in this.map.values) {
      if (o._map[property] == value) {
        return o;
      }
    }
    return null;
  }<commit_msg>Fixed collections<commit_after>part of discord;

/// A collection of objects, easily searchable.
class Collection<T> {
  /// The collection's internal map of objects.
  Map<String, dynamic> map = <String, dynamic>{};

  /// The list of objects in the collection.
  List<dynamic> get list => this.map.values.toList();

  /// The size of the collection.
  int get size => this.map.length;

  /// The first element.
  dynamic get first => this.list.first;

  /// The last element.
  dynamic get last => this.list.last;

  /// Gets a item by it's key.
  dynamic operator [](String key) => this.map[key];

  /// Adds a value to a collection.
  void add(dynamic value) {
    this.map[value['key']] = value;
  }

  /// Finds a single item where `item.property == value`.
  dynamic find(String property, dynamic value) {
    for (dynamic o in this.map.values) {
      if (o._map[property] == value) {
        return o;
      }
    }
    return null;
  }
{'fraction_non_alphanumeric': 0.13761955366631243, 'fraction_numerical': 0.0, 'mean_word_length': 2.614203454894434, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6516585', 'n_tokens_mistral': 591, 'n_tokens_neox': 569, 'n_words': 205}