<commit_before>package com.github.nylle.javafixture;

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

import static java.util.Arrays.asList;

public class SpecimenType {

    private final Class<?> type;
    private final List<Class<?>> genericTypes;

    private SpecimenType(final Class<?> type, final Class<?>... genericTypes) {
        this.type = type;
        this.genericTypes = asList(genericTypes);
    }

    public static SpecimenType forObject(final Class<?> type) {
        return new SpecimenType(type);
    }

    public static SpecimenType forCollection(final Class<?> type, final Class<?> T) {
        return new SpecimenType(type, T);
    }

    public static SpecimenType forMap(final Class<?> type, final Class<?> K, final Class<?> V) {
        return new SpecimenType(type, K, V);
    }

    public static SpecimenType forGeneric(final Class<?> type, final Class<?>... genericTypes) {
        return new SpecimenType(type, genericTypes);
    }

    public Class<?> getType() {
        return type;
    }

    public List<Class<?>> getGenericTypes() {
        return genericTypes;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        final SpecimenType that = (SpecimenType) o;

        if(genericTypes.size() != that.genericTypes.size()) {
            return false;
        }

        boolean allGenericTypesAreEqual = true;
        for(int i = 0; i < genericTypes.size(); i++) {
            allGenericTypesAreEqual &= Objects.equals(genericTypes.get(i), that.genericTypes.get(i));
        }

        return Objects.equals(type, that.type) && allGenericTypesAreEqual;
    }

    @Override
    public int hashCode() {
        return Objects.hash(type, genericTypes);
    }
}<commit_msg>JAVAFIXTURE-20: Refactoring: simplified equals-method<commit_after>package com.github.nylle.javafixture;

import java.util.List;
import java.util.Objects;
import java.util.stream.IntStream;

import static java.util.Arrays.asList;

public class SpecimenType {

    private final Class<?> type;
    private final List<Class<?>> genericTypes;

    private SpecimenType(final Class<?> type, final Class<?>... genericTypes) {
        this.type = type;
        this.genericTypes = asList(genericTypes);
    }

    public static SpecimenType forObject(final Class<?> type) {
        return new SpecimenType(type);
    }

    public static SpecimenType forCollection(final Class<?> type, final Class<?> T) {
        return new SpecimenType(type, T);
    }

    public static SpecimenType forMap(final Class<?> type, final Class<?> K, final Class<?> V) {
        return new SpecimenType(type, K, V);
    }

    public static SpecimenType forGeneric(final Class<?> type, final Class<?>... genericTypes) {
        return new SpecimenType(type, genericTypes);
    }

    public Class<?> getType() {
        return type;
    }

    public List<Class<?>> getGenericTypes() {
        return genericTypes;
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        final SpecimenType that = (SpecimenType) o;

        if(genericTypes.size() != that.genericTypes.size()) {
            return false;
        }

        boolean allGenericTypesAreEqual = IntStream
                .range(0, genericTypes.size())
                .boxed()
                .allMatch(i -> Objects.equals(genericTypes.get(i), that.genericTypes.get(i)));

        return Objects.equals(type, that.type) && allGenericTypesAreEqual;
    }

    @Override
    public int hashCode() {
        return Objects.hash(type, genericTypes);
    }
}
{'fraction_non_alphanumeric': 0.11897943243946889, 'fraction_numerical': 0.001041395469929706, 'mean_word_length': 2.5508317929759703, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, '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': '1790318', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1091, 'n_words': 288}