Saturday 15 September 2012

Refactoring to higher order function in Scala -


I am new to Scala and am wondering if I can refactor this code by using Scala support, High command functions etc. for Fiction Little by any means.

"post-text" itemprop = "text" / P>

Because there is no connection between competition and team, I do not think how it is possible. I think I can add a special quality to the competition and the team, which will include the property of the name and then it will be possible.

Any other options? Besedo's expansion in class competition competition [competition] {def retrieve AllCompetitionNames (): java.util.List [string] = {val competitions: java.util.List [_ & lt;: Competition] = getDao (). QueryForAll () Val ContestantName: java.util.List [String] = New Arrestist (); Competitiveness (Competition & Lieutenant Competitions) Competition (Competition Name) Contestant Name}} class extends the TeamDo Bassadeo [Team] {DR Recovery all team names}: java.util.List [string] = {val teams: java.util.list [_ & Lt; : Team] = meet (). QueryForAll () val TeamName: java.util.List [string] = new arrelist (); Team Team (Team.name) teamNames}}

< P> You can apply a property and use map like Enrique:
  import scala.collection.JavaConversions ._featured NameRetrieval [T & Lt;: {def name: string}] {self: Besedo [t] = & gt; DF Recovery All names = getDao.queryForAll.map (_. Names)}   

You can then use it like this:

  object team Besedo [Team]  [T : {def name: String}}  means that    

Namespace properties can be used for any type, which has an element called name type string . To find out more about that notation search for 'Scala Structural Type'

With Self: Besdao [T] I say that this feature can be used only with a combination of BASADOO whose T is the same type for because this allows me to use the getDao method independently because I know it is available. Similar patterns are used, so that you can see it for more information.

No comments:

Post a Comment