package domain
import java.time.temporal.ChronoUnit
import java.time.{DayOfWeek, LocalDate, LocalDateTime}
import enumeratum._
sealed trait Age extends Ordered[Age] {
def breachEncapsulationOfValue(today: LocalDate): Int入力されたリストの要素を2倍し合計する関数
def loop(in: List[Int], acc: Int): Int =
in match {
case Nil => acc // 終了条件
case head :: tail =>
val result = head * 2 // headのタスク
loop(tail, acc + result) // 残りのリストと計算途中を渡して処理を継続
}public static boolean isNameHashUpperCase(String name) {
boolean result = false;
for (int i = 0; i < name.length; i++) {
if (Character.isUpperCase(name.charAt(i)) {
result = true;
break;
}
}
return result;
This file contains hidden or 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
| object PersistentWalletAggregate { | |
| def behaviorProxy( | |
| id: WalletId, | |
| chargesLimit: Int = Int.MaxValue | |
| ): Behavior[CommandRequest] = | |
| Behaviors | |
| .supervise(Behaviors.setup[CommandRequest] { ctx => | |
| val childRef: ActorRef[CommandRequest] = | |
| ctx.spawn(WalletAggregate.behavior(id, chargesLimit), WalletAggregate.name(id)) |
This file contains hidden or 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
| object TestMain extends App { | |
| import akka.stream.scaladsl._ | |
| import akka.actor._ | |
| import akka.stream.ActorMaterializer | |
| import scala.concurrent._ | |
| import scala.concurrent.duration._ | |
| implicit val system = ActorSystem() | |
| implicit val ec = system.dispatcher | |
| implicit val mat = ActorMaterializer() |
curl -v -X GET https://oss.sonatype.org/content/repositories/releases/com/github/j5ik2o/reactive-redis-core_2.12/1.0.20/reactive-redis-core_2.12-1.0.20.pom INT(-2) ↵ 3243 22:31:44
Note: Unnecessary use of -X or --request, GET is already inferred.
* Trying 23.22.160.79...
* TCP_NODELAY set
* Connected to oss.sonatype.org (23.22.160.79) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
This file contains hidden or 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 btree | |
| package btree | |
| type Node interface { | |
| Size() int | |
| Sum() int64 | |
| Min() int64 | |
| Max() int64 | |
| Find(value int64) *int64 |
This file contains hidden or 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
| trait BTree { | |
| fn size(&self) -> i32; | |
| fn sum(&self) -> i64; | |
| fn min(&self) -> i64; | |
| fn max(&self) -> i64; | |
| fn find(&self, value: i64) -> Option<i64>; | |
| } | |
| enum Node { | |
| Leaf { |
This file contains hidden or 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
| // 絵の具を表すオブジェクト(副作用が伴う可変オブジェクト) | |
| public class Paint { | |
| private int volume; | |
| private PigmentColor pigmentColor; | |
| // getter, setter 省略 | |
| public Paint(PigmentColor pigmentColor, int volume) { | |
| this.volume = volume; | |
| this.pigmentColor = pigmentColor; | |
| } |
This file contains hidden or 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 Money(amount: BigDecimal, | |
| currency: Currency) { | |
| def plus(other: Money): Money = { | |
| require(currency == other.currency) | |
| new Money(amount = amount.add(other.amount), currency) | |
| } | |
| } |