Skip to content

Commit 22a4195

Browse files
committed
Pattern matching is a litt premature for first class function project. Using vanilla 1st class functions for this example.
1 parent e2715fd commit 22a4195

File tree

1 file changed

+1
-4
lines changed
  • first-class-functions/src/test/scala/scalaexamples/firstclassfunctions

1 file changed

+1
-4
lines changed

first-class-functions/src/test/scala/scalaexamples/firstclassfunctions/PersonTest.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ class PersonTest extends EmptyTest {
5252
def testHasMultipleEmails {
5353
// Split the list of persons into two new lists containing
5454
// techies (more than one email address) and luddites (zero or only one email address)
55-
val (techies, luddites) = persons partition (_.emailAddresses match {
56-
case List(_, _, _*) => true
57-
case _ => false
58-
})
55+
val (techies, luddites) = persons.partition(_.emailAddresses.size > 1)
5956

6057
assertEquals(List(fredrik), techies)
6158
assertEquals(List(alf, johannes), luddites)

0 commit comments

Comments
 (0)