 <blockquote> <p>I think what I do here is considered to be bad practice, isn't it?</p> </blockquote> <p>Yes, exposing mutable portions of your class through a getter may be misleading, because the data is not encapsulated well enough. There is nothing wrong with changing the data, it's just that it is done in a way that does not immediately stand out as modification.</p> <p>There is no universal rule to fix this. Generally, you should avoid returning mutable objects inside your class directly. Instead, provide getters and setters where appropriate, and do not give <code>List&lt;B&gt;</code> to your caller:</p> <pre><code>class A { private List&lt;B&gt; bs = new ArrayList&lt;B&gt;; public void getSizeB() { return bs.size(); } public B getB(int i) { return bs.get(i); } public void setB(int i, B b) { bs.set(i, b); } public void addB(B b) { bs.add(B); } ... // Add more methods as needed } </code></pre> <p>The idea is to stay in control of what gets into your <code>List&lt;B&gt;</code>: since there is no direct access, you can validate every <code>B</code> that gets into the list. The code that uses your class <code>A</code> must be explicit about all modifications that it makes, because it cannot get the list directly and do whatever it wants with it.</p>