<commit_before>package dyvil.collection.impl;

import java.util.Iterator;
import java.util.Objects;
import java.util.function.Function;

import dyvil.collection.Collection;
import dyvil.collection.Set;

public abstract class AbstractArraySet<E> implements Set<E>
{
	protected Object[]	elements;
	protected int		size;
	
	public AbstractArraySet(Object... elements)
	{
		this.elements = elements.clone();
		this.size = Set.distinct(this.elements, elements.length);
	}
	
	public AbstractArraySet(Object[] elements, int size)
	{
		this.elements = new Object[size];
		System.arraycopy(elements, 0, this.elements, 0, size);
		this.size = size;
	}
	
	public AbstractArraySet(Object[] elements, int size, boolean trusted)
	{
		this.elements = elements;
		this.size = size;
	}
	
	public AbstractArraySet(Collection<E> elements)
	{
		Object[] array = new Object[elements.size()];
		int index = 0;
		outer:
		for (E element : elements)
		{
			// Check if the element is already present in the array
			for (int i = 0; i < index; i++)
			{
				if (Objects.equals(array[i], element))
				{<commit_msg>Fixed ArraySet constructor allowing duplicate elements<commit_after>package dyvil.collection.impl;

import java.util.Iterator;
import java.util.Objects;
import java.util.function.Function;

import dyvil.collection.Collection;
import dyvil.collection.Set;

public abstract class AbstractArraySet<E> implements Set<E>
{
	protected Object[]	elements;
	protected int		size;
	
	public AbstractArraySet(Object... elements)
	{
		this.elements = elements.clone();
		this.size = Set.distinct(this.elements, elements.length);
	}
	
	public AbstractArraySet(Object[] elements, int size)
	{
		this.elements = new Object[size];
		System.arraycopy(elements, 0, this.elements, 0, size);
		this.size = Set.distinct(this.elements, size);
	}
	
	public AbstractArraySet(Object[] elements, int size, boolean trusted)
	{
		this.elements = elements;
		this.size = Set.distinct(elements, size);
	}
	
	public AbstractArraySet(Collection<E> elements)
	{
		Object[] array = new Object[elements.size()];
		int index = 0;
		outer:
		for (E element : elements)
		{
			// Check if the element is already present in the array
			for (int i = 0; i < index; i++)
			{
				if (Objects.equals(array[i], element))
				{
{'fraction_non_alphanumeric': 0.12026431718061674, 'fraction_numerical': 0.003524229074889868, 'mean_word_length': 4.196796338672769, 'pattern_counts': {'":': 0, '<': 11, '<?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': '5321761', 'n_tokens_mistral': 775, 'n_tokens_neox': 702, 'n_words': 193}