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