Enumeration and mapping with Scala 2.10

后端 未结 2 1599
太阳男子
太阳男子 2020-12-21 04:50

I\'m trying to port my application to Scala 2.10.0-M2. I\'m seeing some nice improvements with better warnings from compiler. But I also got bunch of errors, all related to

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-21 05:15

    As you can see from your error, the ValueSet that holds the enums became a SortedSet at some point. It wants to produce a SortedSet on map, but can't sort on your Entity.

    Something like this works with case class Entity:

    implicit object orderingOfEntity extends Ordering[Entity] {
      def compare(e1: Entity, e2: Entity) = e1.text compare e2.text
    }
    

提交回复
热议问题