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


import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

public class DocumentCollectionEntity implements Serializable {


    private final List<Document> documents = new ArrayList<>();

    private final String name;

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


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

    public void add(Document document) {
        Objects.requireNonNull(document, "Document is required");
        documents.add(document);
    }
<commit_msg>Optimze constructor in DocumentCollectionEntity<commit_after>package org.apache.diana.api.document;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

public class DocumentCollectionEntity implements Serializable {


    private final List<Document> documents = new ArrayList<>();

    private final String name;


    public static DocumentCollectionEntity of(String name) throws NullPointerException {
        return new DocumentCollectionEntity(name);
    }

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


    public String getName() {
        return name;
    }

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

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

{'fraction_non_alphanumeric': 0.0880503144654088, 'fraction_numerical': 0.0, 'mean_word_length': 3.834254143646409, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6206386', 'n_tokens_mistral': 457, 'n_tokens_neox': 433, 'n_words': 118}