Scala

17
Jul
2009

Converting Seq[Option[Any]]) to Seq[Any] and removing None values in Scala

First idea:

seq.filter(_.isDefined).map(_.get)


Second solution from StackOverFlow

seq.flatMap(x=>x)


Overkill solution:

class NonePurger[T] (val seq:Iterable[Option[T]]) {
def purgeNone():Iterable[T] = seq.flatMap(x=>x);
}
implicit def iterableOption2NonePurger[T](seq:Iterable[Option[T]]):NonePurger[T] = new NonePurger(seq);
seq.purgeNone

20
Mrz
2009

Scala Libraries and DSLs

That's a list of libraries/DSLs for Scala that I'm interested in and want to try out in upcoming project.
  • XScalaWT
    Provide a DSL for programming SWT Dialogs. Main benefit: strong Strong type checking. No need for additional tool/language
  • Lift
    THE framework for web development with Scala. Book available:The Lift Book
  • Scala Query
    Think of LINQ or "A Type-Safe Database Query DSL for Scala"
  • ScalaCheck
    Port of QuickCheck for Haskell + additions.
  • Scala Modules
    Aim to ease handling of OSGI in form of a DSL.

15
Nov
2008

Scala und QtJambi

import com.trolltech.qt.gui._

object Application {
def main(args : Array[String]) : Unit = {
val app = new QApplication(args);
val button = new QPushButton("Hello");
button.show;
button.clicked.connect(app, "aboutQt()");
System.exit(QApplication.exec);
}
}
logo

Random Thoughts and Links

Banner

User Status

Du bist nicht angemeldet.

Aktuelle Beiträge

Upgrade HTC Hero to 2.1...
Einfachste Anleitung: http://andreas- lehr.com/blog/archives/229 -T-Mobile-HTC-Hero-unlock. html Kurze...
randomike - 4. Mai, 13:54
Karel Gott ist ein Charaktertyp...
Karel Gott ist ein Charaktertyp mit Humor. Atheismus...
Seba96 - 27. Feb, 17:14
Karel Gott
Atheist Bus Campaign Austria
randomike - 19. Jul, 13:09
Vote for "install cryptsetup...
randomike - 17. Jul, 17:43
Converting Seq[Option[Any]])...
First idea: seq.filter(_.isDefi ned).map(_.get) Second.. .
randomike - 17. Jul, 11:39

Links

RSS Box

News

Suche

 

Status

Online seit 6547 Tagen
Zuletzt aktualisiert: 17. Mai, 21:45

Credits

Web Counter-Modul