<commit_before><commit_msg>Implementation of the Bag data structure utilizing an array as the internal data structure.<commit_after>package com.jeffreydiaz.collections;

import java.util.Iterator;

/**
 * Implementation of the Bag data structure. Where items can be added and traversed, but not removed.
 * Implemented utilizing an array as the internal data structure.
 * @author <NAME>
 */
public class ArrayBag<Item> implements Iterable<Item> {

	private ArrayList<Item> bag;

	/**
	 * Create an empty ArrayBag object.
	 */
	public ArrayBag()
	{
		bag = new ArrayList<Item>();
	}

	/**
	 * Add an item to the bag.
	 * @param item to add to bag.
	 */
	public void add(Item item)
	{
		bag.append(item);
	}

	/**
	 * Know whether bag is empty.
	 * @return True if empty.
	 */
	public boolean isEmpty()
	{
		return bag.isEmpty();
	}

	/**
	 * Get the number of items inside the bag.
	 * @return number of items in bag.
	 */
	public int size()
	{
		return bag.size();
	}

	/**
	 * Get an Iterator object.
	 * @return Iterator object.
	 */
	@Override
	public Iterator<Item> iterator()
	{
		return bag.iterator();
	}
}
{'fraction_non_alphanumeric': 0.11579892280071813, 'fraction_numerical': 0.0, 'mean_word_length': 3.1760299625468167, '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': '7650761', 'n_tokens_mistral': 366, 'n_tokens_neox': 339, 'n_words': 125}