Edited, memorised or added to reading list

on 12-Dec-2014 (Fri)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Flashcard 149626540

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 [...].
Answer
the subclass X


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149627992

Tags
#horstmann-java8-for-really-impatient #java #java8 #lambda-expressions
Question

public class Application() {
  public void doWork() {
    Runnable runner = () -> { ...; System.out.println(this.toString()); ... };
    //...
  }
}

Does this in this.toString() refer to Application or Runnable?
Answer
Application


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







#default-methods #horstmann-java8-for-really-impatient #java #java8
You can never make a default method that redefines one of the methods in the Object class. For example, you can’t define a default method for toString or equals, even though that might be attractive for interfaces such as List. As a consequence of the “classes win” rule, such a method could never win against Object.toString or Object.equals.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java #java8
code to count words where length > 12 in traditional way:

int count = 0;
for (String w : words) {
  if (w.length() > 12) count++;
}
in Java 8 would look like this:

count = words.stream().filter(w -> w.length() > 12).count();

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java #java8
to parallelise search for words here:

count = words.stream().filter(w -> w.length() > 12).count();

you would change a method stream() to parallelStream()

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java
In Java 8 you can turn any collection into a stream with the stream() from the Collection interface.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java
In Java 8 you can turn any array into a stream with the static Stream.of() method.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java #java8
To generate infinite stream from a stateless function, you use Stream.generate()

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java #java8
Stream.iterate() generates an infinite stream from a "seed" (initial value) and then a function repeatedly applied to previous result.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java #java8
The Collections.sort method sorts a collection in place, whereas Stream.sorted returns a new sorted stream.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#horstmann-java8-for-really-impatient #java #java8
The Optional.flatMap method works in the same way as Stream.flatMap if you consider an optional value to be a stream of size zero or one.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#odersky-programming-in-scala-2ed #scala
You can reassign vars

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#odersky-programming-in-scala-2ed #scala
You can't reassign vals

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#odersky-programming-in-scala-2ed #scala
the first element in a Scala array named steps is steps(0), not steps[0], as in Java

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 149629596

Tags
#odersky-programming-in-scala-2ed #scala
Question
What does to stand for in this example?

for (i <- 0 to 2)
  print(greetStrings(i))
Answer
a method call (0).to(2)
if a method takes only one parameter, you can call it without a dot or parentheses.


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







#odersky-programming-in-scala-2ed #scala
You cannot write “println 10”, but you can write “Console println 10”.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 149629623

Tags
#odersky-programming-in-scala-2ed #scala
Question
What does + really stand for in 2 + 3?
Answer
it is a method call: (2).+(3)
method is named "+"


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







#odersky-programming-in-scala-2ed #scala
Accessing an element of an array in Scala is simply a method call like any other. This principle is not restricted to arrays: any application of an object to some arguments in parentheses will be transformed to an apply() method call. Of course this will compile only if that type of object actually defines an apply method.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#odersky-programming-in-scala-2ed #scala
When an assignment is made to a variable to which parentheses and one or more arguments have been applied, the compiler will transform that into an invocation of an update method that takes the arguments in parentheses as well as the object to the right of the equals sign.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 149629682

Tags
#odersky-programming-in-scala-2ed #scala
Question
What will greetStrings(0) = "Hello" be transformed into?
Answer
greetStrings.update(0, "Hello")


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149629693

Tags
#odersky-programming-in-scala-2ed #scala
Question
What method are you calling here and where is it defined?
val numNames = Array("zero", "one", "two")
Answer
a factory method apply which takes variable number of argumetns and is defined on Array companion object
the code gets transformed to
val numNames2 = Array.apply("zero", "one", "two")


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149629708

Tags
#odersky-programming-in-scala-2ed #scala
Question
What does the cons expression, e.g. 1::twoThree, gets translated to (in terms of method calls)?
What rule is used?
Answer
twoThree.::(1)
if a method's name used in operator notation ends with colon, it is called on the right operand


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149629728

Tags
#odersky-programming-in-scala-2ed #scala
Question
to instantiate a new tuple that holds some objects, just [...].
Answer
place the objects in parentheses, separated by commas


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







#odersky-programming-in-scala-2ed #scala
Both mutable and immutable sets offer a + method, but their behavior differs. Whereas a mutable set will add the element to itself, an immutable set will create and return a new set with the element added.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 149629764

Tags
#odersky-programming-in-scala-2ed #scala
Question
Although mutable sets offer an actual += method, immutable sets do not. In this case, jetSet += "Lear", is essentially [...]
Answer
a shorthand for jetSet = jetSet + "Lear"


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149629771

Tags
#odersky-programming-in-scala-2ed #scala
Question
When you add a key-value pair to a map: treasureMap += (2 -> "Dig.") , what is 1 -> "Dig." really?
Answer
It is a method call (1).->("Dig") which returns a tuple containing key and value


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







#odersky-programming-in-scala-2ed #scala
Where you’d say “public” in Java, you simply say nothing in Scala. Public is Scala’s default access level.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#odersky-programming-in-scala-2ed #scala
method parameters in Scala is that they are vals, not vars

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 149629823

Tags
#odersky-programming-in-scala-2ed #scala
Question
Whenever you [...], its result type will definitely be Unit. This is true no matter what the body contains, because the Scala compiler can convert any type to Unit.
Answer
leave off the equals sign before the body of a function


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







#odersky-programming-in-scala-2ed #scala
a semicolon is required if you write multiple statements on a single line

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Flashcard 149629855

Tags
#odersky-programming-in-scala-2ed #scala
Question
When [...], it is called that class’s companion object.
Answer
a singleton object shares the same name with a class


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149629862

Tags
#odersky-programming-in-scala-2ed #scala
Question
What is the class that has companion object called?
Answer
companion class of that object


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149629873

Tags
#odersky-programming-in-scala-2ed #scala
Question
Where a companion class and its companion objects have to be defined?
Answer
in the same source file


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149629884

Tags
#odersky-programming-in-scala-2ed #scala
Question
What is special about access control between companion object and companion class?
Answer
they can access each other's private members


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 149630506

Tags
#odersky-programming-in-scala-2ed #scala
Question
You can't reassign [vars or vals]
Answer
vals


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Parent (intermediate) annotation

Open it
You can't reassign vals

Original toplevel document (pdf)

cannot see any pdfs







#asset-swap #finance #gale-using-and-tradning-asset-swaps
Quoted MVA spread involves a swap of notional equal to bond dirty price.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




#asset-swap #finance #gale-using-and-tradning-asset-swaps
Quoted MVA spread involves a swap of notional equal to bond dirty price. Quoted spread, therefore, does not indicate unwind terms - your asset swap was likely bought at different dirty price than the one currently quoted, so you cannot easily unwind yours.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




par/par asset swap
#asset-swap #finance #gale-using-and-tradning-asset-swaps
Spread: Spread applied to floating leg such that Swap PV = 100 – Bond DP

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




MVA asset swap
#asset-swap #finance #gale-using-and-tradning-asset-swaps
Spread: Spread applied to floating leg such that Swap FV = 100 – Bond DP

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




par/par asset swap
#asset-swap #finance #gale-using-and-tradning-asset-swaps
Trade: Bond bought for par, plus a swap.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




MVA asset swap
#asset-swap #finance #gale-using-and-tradning-asset-swaps
MVA asset swap; trade: Bond bought for dirty price, plus a swap.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




Par/par asset swap
#asset-swap #finance #gale-using-and-tradning-asset-swaps
in par/par asset swap, swap notional is par (of the bond).

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




MVA asset swap
#asset-swap #finance #gale-using-and-tradning-asset-swaps
Swap notional is bond dirty price at settlement.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs




MVA asset swap
#asset-swap #finance #gale-using-and-tradning-asset-swaps
Fee of [Settlement DP] - 100 paid to ASW buyer at expiry.

statusnot read reprioritisations
last reprioritisation on reading queue position [%]
started reading on finished reading on

pdf

cannot see any pdfs