Last active
August 29, 2015 13:58
-
-
Save ElectricCoffee/10018292 to your computer and use it in GitHub Desktop.
simple class enrichment for Seq, that allows you to perform boolean comparisons on them, these comparisons compare the sizes of the lists
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
// it's Seq[_] because we don't really care abou the type, all we're doing is comparing sizes anyway | |
implicit class RichSequence(a: Seq[_]) { | |
def ==(b: Seq[_]): Boolean = a.size == b.size | |
def !=(b: Seq[_]): Boolean = !(a == b) | |
def < (b: Seq[_]): Boolean = a.size < b.size | |
def <=(b: Seq[_]): Boolean = a < b || a == b | |
def > (b: Seq[_]): Boolean = !(a <= b) | |
def >=(b: Seq[_]): Boolean = !(a < b) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment