<commit_before>
import {AssociationValue} from "./AssociationValue";

export class AssociationValues implements Iterable<AssociationValue> {
    constructor(private items: AssociationValue[] = []) {}

    public add(item: AssociationValue): void {
        if (this.contains(item)) {
            return;
        }

        this.items.push(item);
    }

    public contains(item: AssociationValue): boolean {
        return this.items.filter((i) => {
                return i === item;
            }).length > 0;
    }

    public size(): number {
        return this.items.length;
    }

    public clear(): void {
        this.items.splice(0, this.items.length);
    }

    public getArrayCopy(): AssociationValue[] {
        return this.items.slice(0, this.items.length);
    }

    public [Symbol.iterator](): Iterator<AssociationValue> {
        let items: AssociationValue[] = this.getArrayCopy();
        let cursor: number = 0;

        return {
            next: (value?: any): IteratorResult<AssociationValue> => {
                return (cursor === items.length) ? {done: true} : {done: false, value: items[cursor++]};
            }
        };
    }
}
<commit_msg>Contains checks for both key and value.<commit_after>
import {AssociationValue} from "./AssociationValue";

export class AssociationValues implements Iterable<AssociationValue> {
    constructor(private items: AssociationValue[] = []) {}

    public add(item: AssociationValue): void {
        if (this.contains(item)) {
            return;
        }

        this.items.push(item);
    }

    public contains(item: AssociationValue): boolean {
        return this.items.filter((i: AssociationValue) => {
                return i.getKey() === item.getKey() && i.getValue() === item.getValue();
            }).length > 0;
    }

    public size(): number {
        return this.items.length;
    }

    public clear(): void {
        this.items.splice(0, this.items.length);
    }

    public getArrayCopy(): AssociationValue[] {
        return this.items.slice(0, this.items.length);
    }

    public [Symbol.iterator](): Iterator<AssociationValue> {
        let items: AssociationValue[] = this.getArrayCopy();
        let cursor: number = 0;

        return {
            next: (value?: any): IteratorResult<AssociationValue> => {
                return (cursor === items.length) ? {done: true} : {done: false, value: items[cursor++]};
            }
        };
    }
}

{'fraction_non_alphanumeric': 0.13788870703764322, 'fraction_numerical': 0.0032733224222585926, 'mean_word_length': 2.353909465020576, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '3939833', 'n_tokens_mistral': 683, 'n_tokens_neox': 650, 'n_words': 155}