Making my own data type
<p>I'm new to programming and Java. I'm trying to write my own data type/collection class but I'm not quite sure how to go about it. </p>

<p>I want a class that contains a string, and an array-list of strings.</p>

<p>Usually I would go about making a data type like this:</p>

<pre><code>public class Collection {

    private int id;
    private String word;
    private int howMany;
    private char firstChar;

    public Collection (int i, String w, int h, char f){
        id = i;
        word = w;
        howMany = h;
        firstChar = f;
    }
//Getters and Setters
}
</code></pre>

<p>Not sure how I can do this with an ArrayList field. </p>

<p>My goal behind this is to have a class of unique words in the string field read in from .txt files and in the arraylist field have all the .txt file names that contain that word. </p>

<p>Edit: Building on Tom Anderson's Response and what I initially thought to do:</p>

<pre><code>public class Collection {

    private int id;
    private String word;
    private int howMany;
    private char firstChar;
    private List&lt;String&gt; filenames;

    public Collection (int i, String w, int h, char f, List&lt;String&gt; filenames){
        id = i;
        word = w;
        howMany = h;
        firstChar = f;
        this.filenames = filenames;
    }

}
</code></pre>

<p>I'm still not sure how to use this since I can not simply add a string to the ArrayList parameter when creating a new instance of the my Collection Class. Such as this:</p>

<pre><code>ArrayList&lt;Collection&gt; collection = new ArrayList&lt;Collection&gt;();
Collection newTest= new Collection("test","test");
collection.add(newTest);
</code></pre>
