code: public int getCount(final int state)
     {
        int count = 0;
        for (IConcurrentBagEntry e : sharedList) {
           if (e.getState() == state) {
              count++;
           }
        }
        return count;
     }
docs: Get a count of the number of items in the specified state at the time of this call.
  
  @param state the state of the items to count
  @return a count of how many items in the bag are in the specified state