code: public int occurrences(Object obj)
      {
          int count = 0;
          for (int i = 0; i < this.size(); i++)
          {
              if ((obj == null) ? this.get(i) == null : this.get(i).equals(obj))
              {
                  count++;
              }
          }
          return count;
      }
docs: This method returns the number of occurrences of the object <code>obj</code>
  in the <code>DBag</code> collection.
  @param obj The value that may have elements in the collection.
  @return The number of occurrences of <code>obj</code> in this collection.