title: What if tree set object change its value (best practice for treeset?)?
body: <pre><code>List list = new ArrayList();
  MyObj mine = new MyObj();
  list.add(mine); 
  </code></pre>
  
  <p>I like to add object to list before manipulating the object so that i don't forget to add it later, may be i work in crazy enrichment logic where i like this way more </p>
  
  <pre><code>mine.setXXX(stuff);
  </code></pre>
  
  <p>This is the way I always used to add objects in a list,</p>
  
  <p>Just now i have a use case where <code>TreeSet</code> make more sense, so naturally I wanted to do something like this:-</p>
  
  <pre><code>Set set = new TreeSet();
  MyObj mine = new MyObj();
  set.add(mine);
  mine.setXXX(stuff); // add setters here
  </code></pre>
  
  <p>but the issue here is that <code>Treeset</code> needs to have variables used in <code>compareTo</code> methods to be initialized before adding object to the list.</p>
  
  <p>Ok, I can take care of it.</p>
  
  <p>But my worry and question is:-
  Is there a way i can enforce to the developer who may be using my models where I have used <code>Treeset</code> to not repeat my mistake. i.e. to enforece them to intiate the <code>myObject</code> variables before adding the object to the set.
  Though developers should know this and should take care of it, but still is there a way force it or some best practice around that.</p>