Design Pattern for Search and Discovery of items in the system
Post by:amit lkumar
I have a problem at hand. I need to make a design of an application for search and discovery of the products inside it. Suppose I have multiple categories and in each category, I have other sub-categories and in those products are listed. A product can be part of many sub-categories and categories. Is there any design pattern which can come handy. A pseudocode will be lot beneficial.
Post by:Mazer Lao Tzu
, Ranch Hand
This does not sound like problem needing a design pattern per se. Just a simple linear visit.
Recursively visit each category and add the products that are members of those categories to a common Set. Where a Set is a java.util.Set, a data structure that does not accept duplicates. At the end of the recursion, your Set will contain all of the products that are members of any of the categories or sub-categories.
This thread has been viewed 559 times.
All times above are in ranch (not your local) time.
The current ranch time is Oct 16, 2018 13:12:29.