title: Representation exposure
body: <p>Trying to understand what representation exposure is.
  Can you explain the following?</p>
  
  <pre><code>public class CharSet2 {
     private ArrayList&lt;Character&gt; elts    = new ArrayList&lt;Character&gt;();
  
     public void insert(Character c) { elts.add(c); }
     public void delete(Character c) { elts.remove(c); }
     public boolean member(Character c) { return elts.contains(c); }
     public ArrayList&lt;Character&gt; getElts() { return elts; }
  
  
     public static void main(String[] args) {
        CharSet2 s = new CharSet2();
        Character a = new Character('X');
        s.insert(a);
        //s.getElts().add(a);
        s.delete(a);
        if (s.member(a)) System.out.println("Has a");
        else System.out.println("No a");
     }
  }
  </code></pre>
  
  <p>When s.getElts().add(a) is commented out, the result is "No a", but with it, the result is "Has a". Does this mean that the method insert doesn't do anything to the list elts? I thought both s.insert(a) and s.getElts().add(a) would do the same thing. </p>