code: @SuppressWarnings("unchecked")
      protected <T> List<T> getDialogListeners(Class<T> listenerInterface) {
          final Fragment targetFragment = getTargetFragment();
          List<T> listeners = new ArrayList<T>(2);
          if (targetFragment != null && listenerInterface.isAssignableFrom(targetFragment.getClass())) {
              listeners.add((T) targetFragment);
          }
          if (getActivity() != null && listenerInterface.isAssignableFrom(getActivity().getClass())) {
              listeners.add((T) getActivity());
          }
          return Collections.unmodifiableList(listeners);
      }
docs: Utility method for acquiring all listeners of some type for current instance of DialogFragment
  
  @param listenerInterface Interface of the desired listeners
  @return Unmodifiable list of listeners
  @since 2.1.0