Getters in Java -- is what I'm doing safe?
<p>I have a private inner class that encapsulates some functionality. It populates two ArrayLists. I have getters for the ArrayLists that just return the private variable. Are the getters needed? Can I just make the ArrayLists public instance variables? What's the best practice?</p>

<pre><code>public class OuterClass {
    //Stuff the OuterClass does

    private class InnerClass {
        private ArrayList&lt;String&gt; array1;
        private ArrayList&lt;String&gt; array2;

        public InnerClass() {
            //Init and do stuff w/ arrays
        }

        public ArrayList&lt;String&gt; getArray1() {
            return array1;
        }

        public ArrayList&lt;String&gt; getArray2() {
            return array2;
        }
    }
}
</code></pre>
