title: Is it a good practice to return a boolean/value instead of null in case of no-ops?
body: <p>This observation was made after looking at <code>addNode</code> code in  <a href="http://www.keithschwarz.com/interesting/code/?dir=dijkstra" rel="nofollow">DirectedGraph.java</a>. The coder has used a true and a false to distinguish a no-op from an op. A similar example is the code below custom made simply to ask my question easily. Is it a recommended / good practice to return boolean to differentiate and no-op from an op  to give more visibility to the client of code ?</p>
  
  <pre><code>public class FreeMain {
  
      private List&lt;Integer&gt; fooList;
  
      FreeMain ( ) {  }
  
      /**
       * Lazy init - either set a value of no-op.
       * 
       * @param barList
       */
      public void putList(List&lt;Integer&gt; barList) {
          if (this.fooList == null) {
              this.fooList = barList;
          }
      }
  
  
  
      /**
       * Boolean returned as an indication to the user of operation status
       * 
       * @param barList 
       * @return true if putLists sets the value, false is no-op.
       */
      public boolean putListWithBoolean(List&lt;Integer&gt; barList) {
          if (this.fooList == null) {
              this.fooList = barList;
              return true;
          }
          return false;
      }
  }
  </code></pre>