Becoming Functional by Joshua Backfield

Becoming Functional by Joshua Backfield

Author:Joshua Backfield
Language: eng
Format: epub, mobi, pdf
ISBN: 9781449368173
Publisher: O’Reilly Media, Inc.
Published: 2014-10-26T16:00:00+00:00


Your boss at XXY has asked that you create a new function that can get a list of enabled Contacts for all enabled Customers. Let’s start with the simplest implementation by using a method. The method will be called enabledContacts(), and we’ll add it to the Customer. We see this implementation in Example 6-2.

Example 6-2. All enabled contacts method in Customer.java

public List<Contact> enabledContacts() { contacts.findAll { contact -> contact.enabled } }

Well, that was pretty easy, but what happens if we call this multiple times? That’s an easy fix: let’s just make this into a member variable instead of a method.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.