Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!

Rade Koncar

Greenhorn
+ Follow
since Sep 14, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
9
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rade Koncar

ok, thanks Jeanne!
btw, I proposed one errata on this thread https://coderanch.com/t/734831/certification/Java-OCP-Developer-Complete-Study (it is the one about numeric literals)
Hi all,
in a callout "Using flatMap()" by Boyarsky, Jeanne. OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide (p. 712). Wiley. Kindle Edition.

There is a strange example of using flatMap to create int stream... Why would you use a flat map for this example? FlatMap is used to flatten the content of the collection, and here the collection is ready to be streamed as is, right?

I tested with this code, prints the same result:

       var integerList = List.of(1, 2, 3, 4, 5, 6);

       IntStream flatInts = integerList.stream().flatMapToInt(x -> IntStream.of(x));
       IntStream ints = integerList.stream().mapToInt(x -> x);

       flatInts.forEach(System.out::println);
       ints.forEach(System.out::println);

I got used that they explain some strange solutions later in the text, but there is no explanation for this...

Am I missing something?
Oh right, the comparator is passed to a constructor, I thought it populates the TreeSet with this constructor. Thanks!

Campbell Ritchie wrote:What is s1?



Hi,

19:       var s1 = new Sorted(88, "a");

Boyarsky, Jeanne. OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide (p. 664). Wiley. Kindle Edition.

class Sorted implements both Comparable and Comparator.
Hi,

23:       var t2 = new TreeSet<Sorted>(s1);

Boyarsky, Jeanne. OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide (p. 664). Wiley. Kindle Edition.

In the solutions, it is said that: t2 object did specify a comparator when calling the constructor...

But there is no mention of comparator on line 23...

Campbell Ritchie wrote:

Rade Koncar wrote:. . . with the latter four indicating a change of numeric base. . . .

Please confirm the exact details of the book: is it Boyarsky and Selikoff? Please check here whether that has already been reported as an error; I didn't find it.
I think it would read better as,

. . with the latter five indicating a change of numeric base. . . .



Latter five would indicate that 0 is octal zero, and octal zero is in fact 00.
I think the best thing would be to rephrase the whole thing

this is a copy/paste from my kindle:

Numeric literals can begin with 1–9, 0, 0x, 0X, 0b, and 0B, with the latter four indicating a change of numeric base.
Boyarsky, Jeanne. OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide (p. 70). Wiley. Kindle Edition.
Also on page 538: Instantiating an inner class requires an instance of the outer class, such as calling new Outer.new Inner().

It is strange that Outer refers to the instance, Capitalized names often indicate a type.
Hi,

on page 69, kindle version, it says: Numeric literals can begin with 1–9, 0, 0x, 0X, 0b, and 0B, with the latter four indicating a change of numeric base.
What about octal numbers? 0 also can indicate change of numeric base, right?
Hi Jeanne and Scott. I am still Java SE 6.0 certified, hoping to pass the exam for java 11. Some years ago I tried to upgrade to SE 7 but found a lot of stuff to be just memorizing the API and that I found to dull to endure...
But it looks like the upgrade exam to Java 11 has very interesting topics and is worth the effort.
hello to you all, once again! great books, great spirit!
Interesting workaround to this problem. Thanks!
3 years ago
Hi!

When I'm using @Transactional annotation on a method in a manager bean, is this method also transactional if invoked from within the bean itself?
I am asking this because I heard that spring manages this transactional behaviour by wrapping a bean inside a proxy. So if I call it from within a bean itself, then this wrapper will be avoided.
So it won't be transactional after all. Is this right? If so, is there any way to make method transactional regardless of invocation type?
3 years ago
I read here some time ago that 1Z1-813 is also under development...
oh well, congrats to you