Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"&" or ",": What is the difference between A<T extends I1 & I2> and A<T extends I1 , I2>

Multiple generic interface separator: "," or "&"

I was always using A<T extends I1, I2> but today, I saw A<T extends I1 & I2>. What is the difference between these two notation?

Does it have a different meaning? Purpose?

like image 929
ncenerar Avatar asked Dec 06 '12 18:12

ncenerar


People also ask

What do 2 quotation marks mean?

Use double quotation marks (“”) around a direct quote. A direct quote is a word- for-word report of what someone else said or wrote. You use the exact words and punctuation of the original. Harriet Jacobs writes, “She sat down, quivering in every limb” (61).

What is a quotation mark used for?

Quotation marks are most often used to mark something that is spoken or, in other words, to designate a direct quote. That is, they display something that's been said, word for word.

What is the 1 quotation mark called?

Single quotation marks are also known as 'quote marks', 'quotes', 'speech marks' or 'inverted commas'. Use them to: show direct speech and the quoted work of other writers.

What is double quotation called?

Quotation marks can be double ("...") or single ('...') - that is really a matter of style (but see below for more about this). Quotation marks are also called "quotes" or "inverted commas".


1 Answers

A<T extends I1, I2>

is a type A with two parameters

  1. T which must be a subtype of I1
  2. I2

You can read this as "A <preposition> type T which extends I1 <preposition> type I2", so SortedMap<Key extends comparable, Value> is a "map from comparable type key to type value"


A<T extends I1 & I2>

is a type A with a single parameter

  1. T which must be a subtype of I1 and a subtype of I2

You can read this as "A <preposition> type T which extends I1 and I2" so a SortedSerializableSet<T extends Serializable & Comparable> can be read "a sorted set of elements of type T which is both serializable and comparable"

like image 120
Mike Samuel Avatar answered Sep 18 '22 14:09

Mike Samuel