This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalaVersion := "2.11.4" | |
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.2.24" | |
initialCommands += "import scalaz._, Scalaz._" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalaz.{Equal, Monoid} | |
import scalaz.Scalaz._ | |
final case class NonEmpty[A] private[NonEmpty](value: A) | |
object NonEmpty { | |
def wrap[A: Monoid: Equal](value: A): Option[NonEmpty[A]] = | |
if (implicitly[Monoid[A]].zero === value) | |
None | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Properties props = System.getProperties(); | |
props.list(System.out); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.commons.io.FileUtils; | |
... | |
File file = new File(this.getClass().getClassLoader() | |
.getResource("/relativePath/fileName").toURI()); | |
String st = FileUtils.readFileToString(file, "UTF-8"); | |
if resource in same package as present file: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.out.println(System.getProperty("user.dir")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String currentName = new Throwable().getStackTrace()[0].toString(); |