equal
deleted
inserted
replaced
520 // There are also a massive number of Scala tutorials on youtube |
520 // There are also a massive number of Scala tutorials on youtube |
521 // and there are tons of books and free material. Google is your |
521 // and there are tons of books and free material. Google is your |
522 // friend. |
522 // friend. |
523 |
523 |
524 |
524 |
525 |
|
526 |
|
527 |
|
528 // declarative |
|
529 |
|
530 users.filter(_.email.endsWith("@gmail.com")) |
|
531 |
|
532 // imperative |
|
533 |
|
534 val result = ListBuffer[User]() |
|
535 for(user <- users) { |
|
536 if(user.email.endsWith("@gmail.com")) { |
|
537 result += user |
|
538 } |
|
539 } |
|
540 result.toList |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|