object Suit extends Enumeration {
   val Clubs, Diamonds, Hearts, Spades = Value

   implicit class SuitValue(suit: Value) {
      def isRed = !isBlack
      def isBlack = suit match {
         case Clubs | Spades => true
         case _              => false
      }
   }
}


참고링크
https://stackoverflow.com/questions/4346580/how-to-add-a-method-to-enumeration-in-scala

Seq[Future[Seq[SomeClass]의 값을 Future[Seq[SomeClass]]의 형태로 재가공(Squash) 할 필요가 있다.

이런경우 아래와 같이 사용할수 있다.

var after = Future.sequence(before).map(x => x.flatten)

 

 

참고링크

'Scala' 카테고리의 다른 글

Scala Enumeration에 method 추가하기  (0) 2022.05.13

+ Recent posts