public void loadTopics() {
    if (allTopicsMap == null) {
      allTopicsMap = new HashMap<String, NewsCategory>();

      /*
       * Here we rely on the fact that document filenames follow naming
       * convention: <TopicMapKey>-<the rest of filename>
       */
      allTopicsMap.put("biz", new NewsCategory(NewsCategory.BUSINESS));
      allTopicsMap.put("usa", new NewsCategory(NewsCategory.US));
      allTopicsMap.put("world", new NewsCategory(NewsCategory.WORLD));
      allTopicsMap.put("health", new NewsCategory(NewsCategory.HEALTH));
      allTopicsMap.put("sport", new NewsCategory(NewsCategory.SPORTS));
      allTopicsMap.put("tech", new NewsCategory(NewsCategory.TECHNOLOGY));
    } else {
      System.out.println("Topics already loaded:\n");
      for (NewsCategory t : getTopics()) {
        System.out.println(t.getName());
      }
    }
  }
  public List<NewsStoryGroup> getStoryGroupsForTopic(NewsCategory newsCategory) {

    List<NewsStoryGroup> topicGroups = new ArrayList<NewsStoryGroup>();

    for (NewsStoryGroup sg : allStoryGroups.values()) {

      if (newsCategory.equals(sg.getTopic())) {
        topicGroups.add(sg);
      }
    }

    return topicGroups;
  }