/**
 * Implements a collection of words
 */
import java.util.*;

public class WordCollection
{
	private ArrayList allWords;
	

	public WordCollection()
	{
		allWords = new ArrayList();
	}


	public void addWord(String newString)
	{
		allWords.add(new Word(newString));
	}
	

	public void printMatches(String key)
	{
		Word temp = new Word(key);
		int tally = 0;

		System.out.println("Matches for letters: " + key);
		for (int i = 0; i < allWords.size(); i++)
		{
			if (allWords.get(i).equals(temp))
			{	
				System.out.print("\t" + ((Word)allWords.get(i)).getWord());
  				tally++;
			}
		}
		System.out.println();
		
		if (tally == 0)
		{
			System.out.println("No matches were found.");
		}
	}
	
	
	
	public void printWords()
	{
		for (int i = 0; i < allWords.size(); i++)
			System.out.println(allWords.get(i));
	}
	/*
	public void printWords()
	{
		Iterator it = allWords.iterator();
		
		while (it.hasNext())
		{
			System.out.println(it.next());
		}
	}*/
}
