• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
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
 
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!