In App Engine, according to the JavaDoc, the getTypeRank
method has this signature:
public static int getTypeRank(java.lang.Class<? extends java.lang.Comparable> datastoreType)
In the method signature there is a question mark inside the angle brackets:
<? extends java.lang.Comparable>
What does it signify?
Angle Bracket in Java is used to define Generics. It means that the angle bracket takes a generic type, say T, in the definition and any class as a parameter during the calling. The idea is to allow type (Integer, String, … etc and user-defined types) to be a parameter to methods, classes, and interfaces.
What Does Angle Bracket Mean? The angle bracket (< or >), which is also called an “inequality sign” for its use in mathematics, is a kind of sideways caret that can be used to include tags or pieces of code. This ASCII set of characters is common in web design and other types of coding projects.
The Java programming language distinguishes between null and empty strings. An empty string is a string instance of zero length, whereas a null string has no value at all. An empty string is represented as "" . It is a character sequence of zero characters. A null string is represented by null .
Usage of angle bracketsIn some languages, a double set of angle brackets may be used in place of quotation marks to contain quotes. In English, they may be used informally to insert asides, indicate speech in a foreign language, or to mention a website, but all of these uses are rare even in informal writing.
?
essentially indicates a wildcard. <? extends java.lang.Comparable>
means "any type that extends java.lang.Comparable (or Comparable itself) can be used here".
It's called bounded wildcard
<? extends Comparable>
is an example of a bounded wildcard. The ? stands for an unknown type, just like the wildcards we saw earlier. However, in this case, we know that this unknown type is in fact a subtype of Comparable. (Note: It could be Comparableitself, or some subclass; it need not literally extend Comparable.)
More details you find here
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