|
Scala example source code file (EnumTest.scala)
The EnumTest.scala Scala example source codepackage scalaz package std.java object EnumTest extends SpecLite { import syntax.equal._ import std.java.enum._ import java.util.concurrent.TimeUnit "equal" in { TimeUnit.values forall (tu => tu === tu) } "not equal" in { //get all 2-element subsets of TimeUnit @annotation.tailrec def pairs[A](l: List[A], acc: List[(A, A)] = Nil): List[(A, A)] = l match { case Nil | (_ :: Nil) => acc case x :: (xxs @ (_ :: _)) => pairs(xxs, (xxs map (x -> _)) ::: acc) } pairs(TimeUnit.values.toList) forall { case (tu1, tu2) => tu1 =/= tu2 } } } Other Scala examples (source code examples)Here is a short list of links related to this Scala EnumTest.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.