Skip to content

Instantly share code, notes, and snippets.

View xring's full-sized avatar
🎯
Focusing

xring

🎯
Focusing
View GitHub Profile
@xring
xring / java-8-maven-idea.md
Created August 2, 2017 02:13
idea lambda expressions are not supported in -source 1.5

When using lambda in a Maven based project in IntelliJ IDEA, got

idea lambda expressions are not supported in -source 1.5

solved by add this in pom file:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
 maven-compiler-plugin
case class Person1(name: String, age: Int, other: Option[String])
case class Person2(name: String, age: Int, other: String)
import play.api.libs.functional.syntax._
import play.api.libs.json._
implicit val person1Format = (
(JsPath \ "name").format[String] and
(JsPath \ "age").format[Int] and
(JsPath \ "other").formatNullable[String].inmap[Option[String]](x => Some(x.getOrElse("default")), y => y)