Borislav Mirchev

+ Follow
since May 13, 2021
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Borislav Mirchev

In Chapter 7 (Concurrency) Review question 20 the source code is:

Should be:

The reasons for these changes are:
1. <Future>?> cannot be compiled.
2. The expressions used in streams are supposed to be effectively final. (Can test it by replacing .execute with .submit as described in the answers) it is the book errata page. The issue I've found is not mentioned there. The documentation says the iterator() method returns the elements in ascending order, not in the order of insertion. And if I'm properly understanding the terminology ConcurrentSkipListSet is not an ordered collection as mentioned in the TABLE 7.9.

The exact text that can be put in Errata is:

Chapter 7, in Table 7.9 for ConcurrentSkipListSet in the column: Elements ordered? is written Yes.

It should be:

Chapter 7, in Table 7.9  for ConcurrentSkipListSet in the column: Element ordered? the correct value is No.

or something similar.

It is in case an ordered collection is meant that where iterator() returns the elements in order of addition.

In case iterator() returns the element in any possible order or order of insertion for CopyOnWriteArraySet in Java 11 doc is written: "Returns an iterator over the elements contained in this set in the order in which these elements were added."
while in the table in the column: Element ordered?  is written "No" while it should be "Yes".

Probably this table needs an additional review and/or explanation of the Element ordered?'s meaning.
Thank you very much for the detailed explanation! The table is the attached file TheTable2.jpg. Excuse me for the bad quality. The values in red were suspicious at the time of my first post.
In the section: "Working with Concurrent Classes" we have a - TABLE 7.9 "Concurrent collection classes".

In this table we have two columns "Elements ordered?" and "Sorted?" what is their meaning?

I tried some searching using Google to see the difference between sorted and ordered collections and found these:


There many explanations one of it is:

'For convenience, "ordering" will here refer to the order of items returned by an Iterator, and "sorting" will here refer to sorting items according to Comparable or Comparator.'

Executed the following code:

The output is:

Ordering attempt 1.
Ordering attempt 2.

According to this code and the definition I wrote - the ConcurrentSkipListSet is sorted and not ordered.
In the table it is written it is sorted and ordered.

Is my understanding wrong or there is a mistake/error in the table?

Thank you for the attention and time spent on this!

This discussion is useful to me for understanding the details and it is possible to improve the book's quality.

My English is very poor so it is a source of mistakes. Also the book requires lots of concentration and attention during the reading. For this topic I thought a little like a mathematician: Can a process with a single thread be at the same time single-threaded and
multithreaded?! Usually when some categories are created they are mutually exclusive. Some interpretations are possible. You are correct. The authors can answer what was their idea when wrote the book.

I think writing good books for Java became very hard these days. It is a language with 25+ years of history and covering most of its features with a good depth will probably takes something like 2500 - 3000 pages. But who will read them ...
"Introducing Threads" section - first paragraph.

"It follows, then, that a single-threaded process is one that contains exactly one thread, whereas a multithreaded process is one that contains one or more threads.

From this one follows that a process containing exactly one thread is single-threaded and multithreaded. If I'm not wrong the correct one is:

"It follows, then, that a single-threaded process is one that contains exactly one thread, whereas a multithreaded process is one that contains two or more threads.
TABLE 6.1 Common module directives

On the top of the table probably it'd be "Directive" instead of "Derivative".