@Override
    public boolean equals(final Object rhs) {
      if (rhs == null) {
        return false;
      }

      @SuppressWarnings("unchecked")
      final ComparableReference rhso = (ComparableReference) rhs;

      final T lhsElement = get();
      final T rhsElement = rhso.get();

      if ((lhsElement == null) && (rhsElement == null)) {
        return true;
      }
      if ((lhsElement == null) || (rhsElement == null)) {
        return false;
      }
      return lhsElement.equals(rhsElement);
    }
We need this special weak reference class because we store the listeners in a set and we need
set-comparability.
java/zylib/src/main/java/com/google/security/zynamics/zylib/general/ListenerProvider.java