Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the meaning of the '&' character in the returned value?

Tags:

public static <T, U extends Comparable<? super U>> Comparator<T> comparing(         Function<? super T, ? extends U> keyExtractor) {     Objects.requireNonNull(keyExtractor);     return (Comparator<T> & Serializable)         (c1, c2) -> keyExtractor.apply(c1).compareTo(keyExtractor.apply(c2)); } 

The part I'm interested in is this: return (Comparator<T> & Serializable)

Thanks for your help!

like image 438
Harry Avatar asked May 21 '15 12:05

Harry


People also ask

What kind of word is the?

The word the is considered a definite article because it defines the meaning of a noun as one particular thing. It's an article that gives a noun a definite meaning: a definite article. Generally, definite articles are used to identify nouns that the audience already knows about.

What is in English the?

It is the definite article in English.

What is the word the in grammar?

The definite article (the) is used before a noun to indicate that the identity of the noun is known to the reader. The indefinite article (a, an) is used before a noun that is general or when its identity is not known. There are certain situations in which a noun takes no article.

What's the meaning of 831?

"I Love You" (8 letters, 3 words, 1 meaning) is the most common definition for 831 on Snapchat, WhatsApp, Facebook, Twitter, Instagram, and TikTok. 831. Definition: I Love You (8 letters, 3 words, 1 meaning)


1 Answers

This means that the resulting value will be cast to Comparator and Serializable (i.e. a serializable comparator)

Note that when doing casts like this one, you're allowed to specify only one class (and infinite amount of interfaces), because it's not possible for a class to inherit from more than one super-class.

like image 196
Konstantin Yovkov Avatar answered Sep 23 '22 01:09

Konstantin Yovkov