<commit_before>package org.apache.diana.api.document;


import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

import static java.util.Collections.unmodifiableList;

final class DefaultDocumentCollectionEntity implements DocumentCollectionEntity {
    private final List<Document> documents = new ArrayList<>();

    private final String name;


    DefaultDocumentCollectionEntity(String name) {
        this.name = Objects.requireNonNull(name, "name name is required");
    }


    public String getName() {
        return name;
    }

    public boolean remove(String columnName) {
        return documents.removeIf(document -> document.getName().equals(columnName));
    }

    public List<Document> getDocuments() {
        return unmodifiableList(documents);
    }

    public void add(Document document) {
        Objects.requireNonNull(document, "Document is required");
        documents.add(document);
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof DocumentCollectionEntity)) {
            return false;
        }
        DocumentCollectionEntity that = (DocumentCollectionEntity) o;
        return Objects.equals(documents, that.getDocuments()) &&
                Objects.equals(name, that.getName());
    }

    @Override
    public int hashCode() {
        return Objects.hash(documents, name);
    }<commit_msg>Adjust default implementation<commit_after>package org.apache.diana.api.document;


import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;

import static java.util.Collections.unmodifiableList;

final class DefaultDocumentCollectionEntity implements DocumentCollectionEntity {
    private final List<Document> documents = new ArrayList<>();

    private final String name;


    DefaultDocumentCollectionEntity(String name) {
        this.name = Objects.requireNonNull(name, "name name is required");
    }


    public String getName() {
        return name;
    }

    public boolean remove(String columnName) {
        return documents.removeIf(document -> document.getName().equals(columnName));
    }

    public List<Document> getDocuments() {
        return unmodifiableList(documents);
    }

    public void add(Document document) {
        Objects.requireNonNull(document, "Document is required");
        documents.add(document);
    }

    @Override
    public Optional<Document> find(String name) {
        return documents.stream().filter(document -> document.getName().equals(name)).findFirst();
    }

    @Override
    public DocumentCollectionEntity copy() {
        DefaultDocumentCollectionEntity entity = new DefaultDocumentCollectionEntity(this.name);
        entity.documents.addAll(this.getDocuments());
        return entity;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof DocumentCollectionEntity)) {
            return false;
        }
        DocumentCollectionEntity that = (DocumentCollectionEntity) o;
        return Objects.equals(documents, that.getDocuments()) &&
                Objects.equals(name, that.getName());
    }

    @Override
    public int hashCode() {
        return Objects.hash(documents, name);
    }
{'fraction_non_alphanumeric': 0.09764108689160944, 'fraction_numerical': 0.0, 'mean_word_length': 2.9598108747044916, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 13, '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': '4765497', 'n_tokens_mistral': 864, 'n_tokens_neox': 816, 'n_words': 207}