Skip to content

Instantly share code, notes, and snippets.

@harrah
Created July 23, 2010 00:57
Show Gist options
  • Save harrah/486864 to your computer and use it in GitHub Desktop.
Save harrah/486864 to your computer and use it in GitHub Desktop.
import scala.collection.JavaConversions._
object A
{
def main(args: Array[String]) =
{
import X._
val list: java.util.List[GR] = new java.util.ArrayList[GR]
list.add(new GR)
println( list.map(_._1) )
}
}
object X
{
import MSB.restrictionToTuple
implicit def conv(grs: java.util.List[GR]): Seq[(EntityType, Expression[_])] =
(grs: Seq[GR]).map(gr => (EntityType.valueOf(gr.getEntityType), gr.getExpression)).toSeq
//grs.map(gr => (EntityType.valueOf(gr.getEntityType), gr.getExpression)).toSeq
//grs.toSeq
}
object MSB
{
implicit def restrictionToTuple(gr: GR) = (EntityType.valueOf(gr.getEntityType), gr.getExpression)
}
class Expression[T]
class GR
{
def getExpression: Expression[_] = null
def getEntityType = 3
}
object EntityType
{
def valueOf(i: Int) = new EntityType
}
class EntityType
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment