What is AnyType in java. When should i use it.
For example TestRpn<AnyType extends Comparable<AnyType>> in this code snippet what is AnyType, and what kind of data it can have (i.e, like Integer,Boolean)
There is no predefined type named AnyType. I am guessing you have come across a poorly named type parameter variable. The naming convention for type variables is Generic Types">suggested to be single uppercase letters, to avoid this type of confusion.
In your case, TestRpn<AnyType extends Comparable<AnyType>> should be rephrased as TestRpn<E extends Comparable<E>>, which in turn means that you can substitute any type for E that implements Comparable for it's own type. Example: java.lang.String implements Comparable<String>, so TestRpn<String> is a valid parametrization of the above base type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With