title: How to create a dataframe from a list of Scala custom objects
body: <p>We can create a dataframe from a list of Java objects using:</p>
  
  <pre><code>DataFrame df = sqlContext.createDataFrame(list, Example.class);
  </code></pre>
  
  <p>In case of Java, Spark can infer the schema directly from the class, in this case <code>Example.class</code>.</p>
  
  <p>Is there a way to do the same in case of Scala?</p>