code: public static int frequency(Collection<?> c, Object o) {
          int result = 0;
          if (o == null) {
              for (Object e : c)
                  if (e == null)
                      result++;
          } else {
              for (Object e : c)
                  if (o.equals(e))
                      result++;
          }
          return result;
      }
docs: Returns the number of elements in the specified collection equal to the
  specified object.  More formally, returns the number of elements
  <tt>e</tt> in the collection such that
  <tt>(o == null ? e == null : o.equals(e))</tt>.
  
  @param c the collection in which to determine the frequency
  of <tt>o</tt>
  @param o the object whose frequency is to be determined
  @return the number of elements in {@code c} equal to {@code o}
  @throws NullPointerException if <tt>c</tt> is null
  @since 1.5