├── cargo
│ ├── Cargo.java
│ ├── CargoRepository.java
│ ├── Delivery.java
│ ├── HandlingActivity.java
│ ├── Itinerary.java
│ ├── Leg.java
│ ├── RouteSpecification.java
│ ├── RoutingStatus.java
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
package example | |
/** | |
* 値が存在する・しないの両状態を表す型を表すトレイト。 | |
* | |
* @tparam A 値の型 | |
*/ | |
sealed trait MyOption[+A] { | |
/** |
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 java.io._ | |
import java.nio.charset.StandardCharsets | |
object LoarnMain extends App { | |
def getFileBody(file: String): String = | |
using(new FileInputStream(file)) { fis => | |
val text = new Array[Byte](fis.available) | |
fis.read(text) | |
new String(text, StandardCharsets.UTF_8) |
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
style = defaultWithAlign # For pretty alignment. | |
maxColumn = 100 # For my wide 30" display. | |
includeCurlyBraceInSelectChains = false | |
newlines.penalizeSingleSelectMultiArgList = false | |
project.git = true | |
project.excludeFilters = ["target/"] |
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
scala> val getTimeString = new Function0[String] { | |
| override def apply: String = ZonedDateTime.now.toString | |
| } | |
getTimeString: () => String = <function0> | |
scala> :javap getTimeString | |
Size 902 bytes | |
MD5 checksum dc6b8c20b0a3937afbe114e129c22cb9 | |
Compiled from "<console>" | |
public class $line4.$read$$iw$$iw$$iw$$iw$ |
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
class BankAccount { | |
public void setName(String name) { | |
this.name = name; | |
} | |
public void setCustomerId(long customerId) { | |
this.customerId = customerId | |
} | |
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
case class Administrators(userId: Long, userIds: Seq[Long]) | |
case class Member(userId: Long, byAdministratorId: Option[Long] = None) | |
case class Memebers(userIds: Seq[Member]) | |
case class Message(id: Long, value: String, senderId: Long) | |
case class Messages(values: Seq[Message]) |
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
val childProps = Props(classOf[EchoActor]) | |
val stopBackOffOptions = Backoff.onStop(childProps, "c1", 100.millis, 3.seconds, 0.2) | |
val failureBackOffOptions = Backoff.onFailure(childProps, "c1", 100.millis, 3.seconds, 0.2) | |
val stopBackOffSupervisor = system.actorOf(BackoffSupervisor.props(stopBackOffOptions)) | |
val failureBackOffSupervisor = system.actorOf(BackoffSupervisor.props(failureBackOffOptions)) |
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
case class Item( | |
id: Option[Long], | |
code: String, | |
name: String, | |
url: String, | |
imageUrl: String, | |
price: Int, | |
createAt: DateTime, | |
updateAt: DateTime, | |
users: Seq[User] = Seq.empty |
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
case class User(id: Long, name: Option[String]) | |
object UserDao { | |
def findById(id: Long): Option[User] = { | |
if (id % 3 == 0) | |
Some(User(id, Some("Kaneko"))) | |
else if (id % 5 == 0) | |
Some(User(id, None)) | |
else |