2

In Java, I've come across a method that is formatted like this:

public final Subscription subscribe(final Action1<? super T> onNext, final Action1<Throwable> onError) {
}

In the first parameter, what does the question mark and super mean?

AndroidDev
  • 20,063
  • 26
  • 131
  • 216

1 Answers1

2

? here means everything that is a superclass of T

super means what you can put into the class (at most this, perhaps a superclass).

Because super indicates the lower bounding class of a generic element. So, Action1<? super T> could represent Action1<T> or Action1<Object>.

Bahramdun Adil
  • 5,435
  • 6
  • 31
  • 62