public List<NewsReference> getNews(Set<INews.State> states) {
    List<NewsReference> newsRefs = new ArrayList<NewsReference>(getNewsCount(states));

    for (INews.State state : states) {
      int index = state.ordinal();
      LongArrayList newsIds = fNewsIds[index];
      for (int i = 0, c = newsIds.size(); i < c; ++i) {
        long newsId = newsIds.get(i);
        Assert.isLegal(newsId != 0);
        newsRefs.add(new NewsReference(newsId));
      }
    }

    return newsRefs;
  }
  public Pair<Boolean, Boolean> setNews(Map<INews.State, List<NewsReference>> newsMap) {
    Assert.isNotNull(newsMap, "newsMap"); // $NON-NLS-1$

    boolean changed = false;
    boolean isNewNewsAdded = false;

    Set<INews.State> statesToReset = EnumSet.allOf(INews.State.class);
    statesToReset.removeAll(newsMap.keySet());

    /* Reset all ArrayLists whose state is not present in newsMap */
    for (INews.State state : statesToReset) {
      int index = state.ordinal();
      LongArrayList currentArrayList = fNewsIds[index];
      if (currentArrayList.size() > 0) {
        currentArrayList.clear();
        changed = true;
      }
    }

    /* For each Result */
    for (Map.Entry<INews.State, List<NewsReference>> mapEntry : newsMap.entrySet()) {
      List<NewsReference> news = mapEntry.getValue();
      INews.State state = mapEntry.getKey();

      Assert.isNotNull(news, "news"); // $NON-NLS-1$
      Assert.isNotNull(state, "state"); // $NON-NLS-1$

      long[] newArray = new long[news.size()];

      /* Fill Bucket */
      for (int i = 0; i < news.size(); i++) {
        newArray[i] = news.get(i).getId();
      }

      int index = state.ordinal();
      LongArrayList currentArrayList = fNewsIds[index];

      if (state.equals(INews.State.NEW)) {
        /* Check for added *new* News */

        if (newArray.length > currentArrayList.size()) isNewNewsAdded = true;
        else {
          for (long value : newArray) {
            if (currentArrayList.indexOf(value) < 0) {
              isNewNewsAdded = true;
              break;
            }
          }
        }
        if (isNewNewsAdded || (newArray.length != currentArrayList.size())) {
          changed = true;
          currentArrayList.setAll(newArray);
        }
      } else {
        if (!currentArrayList.elementsEqual(newArray)) {
          currentArrayList.setAll(newArray);
          changed = true;
        }
      }
    }

    return Pair.create(changed, isNewNewsAdded);
  }