• Post Reply Bookmark Topic Watch Topic
  • New Topic

Design Pattern for Search and Discovery of items in the system  RSS feed

 
amit lkumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thanks,
Amit
 
Mazer Lao Tzu
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!