Edited, memorised or added to reading queue
Do you want BuboFlash to help you learning these things?
Click here to log in or create user.
#finance #greeks #has-images
|
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Greeks (finance) - Wikipedia, the free encyclopediaor4.2 Speed4.3 Ultima4.4 Zomma
5 Greeks for multi-asset options6 Formulas for European option Greeks7 Related measures
7.1 Bond duration and convexity7.2 Beta7.3 Fugit
8 See also9 Notes10 References11 External links
Use of the Greeks[edit]
<span>Spot
Price (S)Volatility
()Time to
Expiry ()Value (V) Delta Vega ThetaDelta () GammaVannaCharmVega () VannaVommaVetaGamma () SpeedZommaColorVomma UltimaTotto
Definition of Greeks as the sensitivity of an option's price and risk (in the first column) to the underlying parameter (in the first row). First-order Greeks are in blue, second-order Greeks are in green, and third-order Greeks are in yellow. Note that vanna appears twice as it should, and rho is left out as it is not as important as the rest.
The Greeks are vital tools in risk management. Each Greek measures the sensitivity of the value of a portfolio to a small change in a given underlying parameter, so that component risks
Tags
#bloch-effective-java-2ed #java
Question
Suppose we have a class
public class Point {
private final int x;
private final int y;
@Override public boolean equals(Object o) {
if (!(o instanceof Point))
return false;
Point p = (Point)o;
return p.x == x && p.y == y;
}
// Remainder omitted
}
and a subclass
public class ColorPoint extends Point {
private final Color color;
@Override public boolean equals(Object o) {
if (!(o instanceof ColorPoint))
return false;
return super.equals(o) && ((ColorPoint) o).color == color;
}
// Remainder omitted
}
what are the consequences of implementing equals() method on ColorPoint like above?
Answer
It violates symmetry. You get different results when comparing a point to a color point and vice versa.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Tags
#bonds #duration #finance
Question
For most practical calculations, the Macaulay duration is calculated using the
[...]
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itFor most practical calculations, the Macaulay duration is calculated using the yield to maturityOriginal toplevel document
Bond duration - Wikipedia, the free encyclopediaey are and the final large circle including the final principal repayment. If these circles were put on a balance beam, the fulcrum of the beam would represent the weighted average distance (time to payment), which is 1.78 years in this case.
<span>For most practical calculations, the Macaulay duration is calculated using the yield to maturity to calculate the :
(2)
(3)
where:
indexes the cash flows, is the present value of the th cash payment from an asset, is the cash flow of the th payment from an asset, is the y
Tags
#bonds #duration #finance
Question
DV01 is the ratio of a [...]to unit change in input (a basis point of yield).
Answer
price change in output (dollars)
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itDV01 is the ratio of a price change in output (dollars) to unit change in input (a basis point of yield).Original toplevel document
Bond duration - Wikipedia, the free encyclopediato yield:
so that it is the product of the modified duration and the price (value):
($ per 1 percentage point change in yield)
or
($ per 1 basis point change in yield)
The DV01 is analogous to the delta in derivative pricing (The Greeks) – <span>it is the ratio of a price change in output (dollars) to unit change in input (a basis point of yield). Dollar duration or DV01 is the change in price in dollars, not in percentage. It gives the dollar variation in a bond's value per unit change in the yield. It is often measured per 1 bas
Tags
#bonds #duration #finance
Question
DV01 is the ratio of a price change in output (dollars) to [...].
Answer
unit change in input (a basis point of yield)
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itDV01 is the ratio of a price change in output (dollars) to unit change in input (a basis point of yield).Original toplevel document
Bond duration - Wikipedia, the free encyclopediato yield:
so that it is the product of the modified duration and the price (value):
($ per 1 percentage point change in yield)
or
($ per 1 basis point change in yield)
The DV01 is analogous to the delta in derivative pricing (The Greeks) – <span>it is the ratio of a price change in output (dollars) to unit change in input (a basis point of yield). Dollar duration or DV01 is the change in price in dollars, not in percentage. It gives the dollar variation in a bond's value per unit change in the yield. It is often measured per 1 bas
Tags
#bonds #duration #finance
Question
[another name of DV01, not the meaning of the abbreviation DV01] or DV01 is the change in price in dollars, not in percentage.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itDollar duration or DV01 is the change in price in dollars, not in percentage.Original toplevel document
Bond duration - Wikipedia, the free encyclopediae point change in yield)
or
($ per 1 basis point change in yield)
The DV01 is analogous to the delta in derivative pricing (The Greeks) – it is the ratio of a price change in output (dollars) to unit change in input (a basis point of yield). <span>Dollar duration or DV01 is the change in price in dollars, not in percentage. It gives the dollar variation in a bond's value per unit change in the yield. It is often measured per 1 basis point - DV01 is short for "dollar value of an 01" (or 1 basis poi
Tags
#bonds #duration #finance
Question
Dollar duration or [short name of dollar duration] is the change in price in dollars, not in percentage.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itDollar duration or DV01 is the change in price in dollars, not in percentage.Original toplevel document
Bond duration - Wikipedia, the free encyclopediae point change in yield)
or
($ per 1 basis point change in yield)
The DV01 is analogous to the delta in derivative pricing (The Greeks) – it is the ratio of a price change in output (dollars) to unit change in input (a basis point of yield). <span>Dollar duration or DV01 is the change in price in dollars, not in percentage. It gives the dollar variation in a bond's value per unit change in the yield. It is often measured per 1 basis point - DV01 is short for "dollar value of an 01" (or 1 basis poi
Tags
#bonds #duration #finance
Question
Dollar duration or DV01 is the change in price in [...], not in [...].
Answer
in dollars, not in percentage
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itDollar duration or DV01 is the change in price in dollars, not in percentage.Original toplevel document
Bond duration - Wikipedia, the free encyclopediae point change in yield)
or
($ per 1 basis point change in yield)
The DV01 is analogous to the delta in derivative pricing (The Greeks) – it is the ratio of a price change in output (dollars) to unit change in input (a basis point of yield). <span>Dollar duration or DV01 is the change in price in dollars, not in percentage. It gives the dollar variation in a bond's value per unit change in the yield. It is often measured per 1 basis point - DV01 is short for "dollar value of an 01" (or 1 basis poi
Tags
#bonds #finance #yield-to-maturity #z-spread
Question
Given a single series of
nominal cash flows (like a riskless bond). If these payments are discounted to
net present value with a static [...]yield curve the sum of their values will tend to overestimate the market price of the priced instrument. The
parallel shift, which, if applied to the yield curve makes the
NPV of the anticipated receipts equal to the market price is the
Yield curve spread (aka Z-spread).
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itGiven a single series of nominal cash flows (like a riskless bond). If these payments are discounted to net present value with a static treasury yield curve the sum of their values will tend to overestimate the market price of the priced instrument. The parallel shift, which, if applied to the yield curve makes the NPV of the antOriginal toplevel document
Z-spread - Wikipedia, the free encyclopediaage-backed securities, a model of typical repayment rates tends to be given; for example, the PSA formula for a particular Fannie Mae MBS might equate a particular group of mortgages to an 8 year amortizing bond with a 5% mortality per annum. <span>This gives a single series of nominal cash flows (like a riskless bond). If these payments are discounted to net present value with a static treasury yield curve the sum of their values will tend to overestimate the market price of the MBS. The parallel shift, which, if applied to the yield curve makes the NPV of the anticipated receipts equal to the market price is the Yield curve spread.
The Z-spread of a bond is the number of basis points one needs to add to the Treasury spot rates yield curve, so that the NPV of the bond cash flows (using the adjusted yield curve) equa
Tags
#bonds #finance #yield-to-maturity #z-spread
Question
Given a single series of
nominal cash flows (like a riskless bond). If these payments are discounted to
net present value with a static treasury yield curve the sum of their values will tend to
[overestimate or underestimate?] the market price of the priced instrument. The
parallel shift, which, if applied to the yield curve makes the
NPV of the anticipated receipts equal to the market price is the
Yield curve spread (aka Z-spread).
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itGiven a single series of nominal cash flows (like a riskless bond). If these payments are discounted to net present value with a static treasury yield curve the sum of their values will tend to overestimate the market price of the priced instrument. The parallel shift, which, if applied to the yield curve makes the NPV of the anticipated receipts equal to the market price is the Yield curveOriginal toplevel document
Z-spread - Wikipedia, the free encyclopediaage-backed securities, a model of typical repayment rates tends to be given; for example, the PSA formula for a particular Fannie Mae MBS might equate a particular group of mortgages to an 8 year amortizing bond with a 5% mortality per annum. <span>This gives a single series of nominal cash flows (like a riskless bond). If these payments are discounted to net present value with a static treasury yield curve the sum of their values will tend to overestimate the market price of the MBS. The parallel shift, which, if applied to the yield curve makes the NPV of the anticipated receipts equal to the market price is the Yield curve spread.
The Z-spread of a bond is the number of basis points one needs to add to the Treasury spot rates yield curve, so that the NPV of the bond cash flows (using the adjusted yield curve) equa
Tags
#bonds #finance #yield-to-maturity #z-spread
Question
Given a single series of
nominal cash flows (like a riskless bond). If these payments are discounted to
net present value with a static treasury yield curve the sum of their values will tend to
overestimate the market price of the priced instrument. The
[...] is the Yield curve spread (aka Z-spread).
Answer
parallel shift, which, if applied to the yield curve makes the
NPV of the anticipated receipts equal to the market price
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itgle series of nominal cash flows (like a riskless bond). If these payments are discounted to net present value with a static treasury yield curve the sum of their values will tend to overestimate the market price of the priced instrument. The <span>parallel shift, which, if applied to the yield curve makes the NPV of the anticipated receipts equal to the market price is the Yield curve spread (aka Z-spread).<span><body><html>Original toplevel document
Z-spread - Wikipedia, the free encyclopediaage-backed securities, a model of typical repayment rates tends to be given; for example, the PSA formula for a particular Fannie Mae MBS might equate a particular group of mortgages to an 8 year amortizing bond with a 5% mortality per annum. <span>This gives a single series of nominal cash flows (like a riskless bond). If these payments are discounted to net present value with a static treasury yield curve the sum of their values will tend to overestimate the market price of the MBS. The parallel shift, which, if applied to the yield curve makes the NPV of the anticipated receipts equal to the market price is the Yield curve spread.
The Z-spread of a bond is the number of basis points one needs to add to the Treasury spot rates yield curve, so that the NPV of the bond cash flows (using the adjusted yield curve) equa
Tags
#bonds #duration #finance
Question
Macaulay duration is a weighted average [...] until repayment (measured in [...])
Answer
time until repayments, e.g. coupons and principal (measured in units of time such as years)
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itMacaulay duration is a weighted average time until repayment (measured in units of time such as years)Original toplevel document
Bond duration - Wikipedia, the free encyclopediathe asset.
This gives the well-known relation between Macaulay duration and modified duration quoted above. It should be remembered that, even though Macaulay duration and modified duration are closely related, they are conceptually distinct. <span>Macaulay duration is a weighted average time until repayment (measured in units of time such as years) while modified duration is a price sensitivity measure when the price is treated as a function of yield, the percentage change in price with respect to yield.
Units[edit]
For modified du
Tags
#bonds #duration #finance
Question
[...]is a price sensitivity measure when the price is treated as a function of yield, the percentage change in price with respect to yield.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itmodified duration is a price sensitivity measure when the price is treated as a function of yield, the percentage change in price with respect to yield.Original toplevel document
Bond duration - Wikipedia, the free encyclopediat should be remembered that, even though Macaulay duration and modified duration are closely related, they are conceptually distinct. Macaulay duration is a weighted average time until repayment (measured in units of time such as years) while <span>modified duration is a price sensitivity measure when the price is treated as a function of yield, the percentage change in price with respect to yield.
Units[edit]
For modified duration the common units are the percent change in price per one percentage point change in yield per year (for example yield going from 8% per year (y = 0.08)
Tags
#bonds #finance #yield-to-maturity #z-spread
Question
Conventionally, the zero rates for calculating Z-spread are determined from the
Treasury curve, with [...]compounding.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Parent (intermediate) annotation
Open itConventionally, the zero rates for calculating Z-spread are determined from the Treasury curve, with semi-annual compounding.Original toplevel document
Z-spread - Wikipedia, the free encyclopediaonal factors such as liquidity and credit risk. The Z-spread quantifies the impact of these additional factors. It is the spread you need to add to the curve you are discounting with in order to generate a price that matches the market price.
<span>Conventionally, the zero rates are determined from the Treasury curve, with semi-annual compounding.
The Problem with YTM spreads[edit]
Coupon Paying bonds are essentially portfolios of Zero Coupon Bond components and the Yield to Maturity of such instruments can be thought of as being
Tags
#bloch-effective-java-2ed #java
Question
How to calculate hash code of a double?
Answer
Double.doubleToLongBits(f) and then calculate hash code of the resulting long.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Tags
#bloch-effective-java-2ed #java
Question
How to combine hash codes from different fields of an object?
Answer
Initially, result = 17; // any non zero value
then result = 31 * result + hashCodeOfAField; // for each field
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Tags
#bloch-effective-java-2ed #java
Question
clone() creates an object without [...]
Answer
without calling the constructor
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Tags
#bloch-effective-java-2ed #java
Question
Programmers assume that if they extend a class and invoke super.clone from the subclass X, the returned object will be an instance of [...].
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Question
Programmers assume that if they extend a class and invoke super.clone from the subclass, the returned object will be an instance of the subclass. The only way a superclass can provide this functionality is to return an object obtained by calling [...] and have [...] obey the same rule [...] which creates [...]
Answer
super.clone() and have all the superclasses obey the same rule up till Object, which creates the object of the correct class.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Tags
#bloch-effective-java-2ed #java
Question
what does the Object's clone() method return? Describe 2 cases
Answer
it returns a copy of the object of the correct (runtime) class and copies fields as if by (assignment) = operator if actual class implements Cloneable, otherwise it throws CloneNotSupportedException.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Tags
#bloch-effective-java-2ed #java
Question
the clone architecture is incompatible with normal use of [...] fields referring to mutable objects
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
#bloch-effective-java-2ed #java
Object’s clone method is declared to throw CloneNotSupportedException, but overriding clone methods can omit this declaration.
|
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Tags
#bloch-effective-java-2ed #java
Question
what methods does Cloneable interface have?
Answer
none, not even clone() - you are expected to provide public clone() though on classes that implement Cloneable
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Article 149626615Joshua Bloch "Effective Java"#bloch-effective-java-2ed #java
Book on effective use of Java, must-read when you prepare for an interview as a Java programmer.
I was reading the book and every flashcard or article I created were annotated like this:
#bloch-effective-java-2ed #java #pXX, where XX is page number.
The book can be found in amazon.co.uk
Tags
#bloch-effective-java-2ed #java
Question
Because of its many shortcomings, some expert programmers simply choose never to override the clone() method and never to invoke it except, perhaps, to copy [...]
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
#bloch-effective-java-2ed #java
the same caveat applies to compareTo() as to equals(): there is no way to extend an instantiable class with a new value component while preserving the compareTo contract, unless you are willing to forgo the benefits of object-oriented abstraction
|
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Tags
#bloch-effective-java-2ed #java
Question
What is wrong with this implementation of compareTo()?
public int compareTo(PhoneNumber pn) {
return lineNumber - pn.lineNumber;
}
Answer
if pn.lineNumber is large and negative, int substraction can overflow silently
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
#bloch-effective-java-2ed #java
For top-level (non-nested) classes and interfaces, there are only two possible access levels: package-private and public.
|
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Tags
#bloch-effective-java-2ed #java
Question
Why is it wrong?
public static final Thing[] VALUES = { ... };
Answer
Non-zero length arrays are always mutable
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Article 149626689#bloch-effective-java-2ed #java #p109
A class or interface whose declaration has one or more type parameters is a generic class or interface.
Tags
#bloch-effective-java-2ed #java #java-generics
Question
A class or interface whose declaration has one or more [...]is a generic class or interface.
Answer
(formal) type parameters
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Open itA class or interface whose declaration has one or more type parameters is a generic class or interface.
Tags
#bloch-effective-java-2ed #java #java-generics
Question
A class or interface whose declaration has one or more type parameters is a [...]class or interface.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Open itA class or interface whose declaration has one or more type parameters is a generic class or interface.
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Generic classes and interfaces are collectively known as [...].
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Article 149626728#bloch-effective-java-2ed #java #p109
Each generic type defines a set of parameterized types, which consist of the class or interface name followed by an angle-bracketed list of actual type parameters corresponding to the generic type’s formal type parameters.
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Each generic type defines a set of [...], which consist of the class or interface name followed by an angle-bracketed list of actual type parameters corresponding to the generic type’s formal type parameters.
Answer
parameterized types
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Open itEach generic type defines a set of parameterized types, which consist of the class or interface name followed by an angle-bracketed list of actual type parameters corresponding to the generic type’s formal type parameters.</bo
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Each generic type defines a set of parameterized types, which consist of the class or interface name followed by an angle-bracketed list of [...].
Answer
actual type parameters (corresponding to the generic type’s formal type parameters)
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Open itEach generic type defines a set of parameterized types, which consist of the class or interface name followed by an angle-bracketed list of actual type parameters corresponding to the generic type’s formal type parameters.
Article 149626755#bloch-effective-java-2ed #java #p109
Each generic type defines a raw type, which is the name of the generic type used without any accompanying actual type parameters
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Each generic type defines a [...], which is the name of the generic type used without any accompanying actual type parameters
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Open itEach generic type defines a raw type, which is the name of the generic type used without any accompanying actual type parameters
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Each generic type defines a raw type, which is the
Answer
name of the generic type used without any accompanying actual type parameters
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Open itEach generic type defines a raw type, which is the name of the generic type used without any accompanying actual type parameters
Tags
#bloch-effective-java-2ed #java #java-generics
Question
What element can you put into Collection<?> ?
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Tags
#bloch-effective-java-2ed #java #java-generics
Question
How can you use generics in class literals, e.g. XX.class or (y instanceof XX) ?
Answer
You can't. For example List<String>.class is illegal. You have to use raw types.
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
Article 149626800generics terms quick reference#bloch-effective-java-2ed #java #p115
TermExampleParameterized typeList<String>Actual type parameterStringGeneric typeList<E>Formal type parameterEUnbounded wildcard typeList<?>Raw typeListBounded type parameter<E extends Number>Recursive type bound<T extends Comparable<T>>Bounded wildcard typeList<? extends Number>Generic method static<E> List<E> asList(E[] a)Type tokenString.class
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
[...] | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Parameterized type
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
[...] | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Actual type parameter
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asLis
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
[...] | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type token
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
[...] | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Formal type parameter
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type tokenString.class
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
[...] | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Unbounded wildcard type
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type tokenString.class
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
[...] | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type tokenString.class
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
[...] | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Bounded type parameter
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type tokenString.class
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
[...] | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Recursive type bound
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type tokenString.class
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
[...] | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Bounded wildcard type
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referenceTermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type tokenString.class
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
[...] | <E> List<E> asList(E[] a) |
Type token | String.class |
Answer
Generic method static
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referencetml>TermExampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)Type tokenString.class<html>
Tags
#bloch-effective-java-2ed #java #java-generics
Question
Term | Example |
---|
Parameterized type | List<String> |
Actual type parameter | String |
Generic type | List<E> |
Formal type parameter | E |
Unbounded wildcard type | List<?> |
Raw type | List |
Bounded type parameter | <E extends Number> |
Recursive type bound | <T extends Comparable<T>> |
Bounded wildcard type | List<? extends Number> |
Generic method static | <E> List<E> asList(E[] a) |
[...] | String.class |
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|
generics terms quick referencexampleParameterized typeListActual type parameterStringGeneric typeListFormal type parameterEUnbounded wildcard typeListRaw typeListBounded type parameterRecursive type bound>Bounded wildcard typeListGeneric method static List asList(E[] a)<span>Type tokenString.class<span><body><html>
Tags
#bloch-effective-java-2ed #java #java-generics
Question
How to cast raw type Set to typesafe Set using generics?
if (o instanceof Set) { // Raw type
// here
}
Answer
Use unbounded wildcard type:
if (o instanceof Set) { // Raw type
Set<?> m = (Set<?>) o; // Wildcard type
// rest of the code
}
status | not learned | | measured difficulty | 37% [default] | | last interval [days] | |
---|
repetition number in this series | 0 | | memorised on | | | scheduled repetition | |
---|
scheduled repetition interval | | | last repetition or drill | | | | |
---|