fabriciofx/cactoos-jdbc

Change List<Contact> to Contacts?

Opened this issue · 3 comments

@amihaiemil I've read your post An Extension To TellDontAsk and I liked very much. Congratulations! So, based on it, I'm thinking change the SqlContacts code here to return a Contacts instead of a List<Contacts>. To achieve this, I must implement a FilteredContacts, as you've suggested on post. So, my doubt is: how do you think should be the constructor signature? FilteredContacts(final List<Contacts> found, final String name)?

@fabriciofx hi and thanks for your feedback! I will have a look over your questiins (also the ones from Disqus) and will answer over the weekend (very busy week now)

@amihaiemil Ok! Thanks in advance!

@fabriciofx Well, depends on the moment you want to make the filtering: do you want the SQL server to directly return the contacts respecting the filter, or do you want to fetch them all and filter them in-memory yourself?

I would go with the first option (fetch them already filtered), so I think your FilteredContacts should be built uisng the Session and a Map or filters (or however you want to store your filters).

Later, think about how the FilteredContacts will behave if you call filter(...) on it many times: will it keep the previously specified filters or will it flush and use only the ones specified at the latest filter(...) method call?