Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

OCP SE 11 Developer Complete Study Guide errata

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Marshal
Posts: 70718
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is s1?
 
Rade Koncar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Campbell Ritchie
Marshal
Posts: 70718
288
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rade Koncar wrote:. . . Sorted implements both Comparable and Comparator.

A strange design decision, I think, but it occurs in cert exams and cert exam books
In that case, s1 is a Comparator and the original is correct.
 
Rade Koncar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh right, the comparator is passed to a constructor, I thought it populates the TreeSet with this constructor. Thanks!
 
Campbell Ritchie
Marshal
Posts: 70718
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a pleasure

I think you should review the constructors; you need to have some sort of concept of that information for the exam. Note there don't seem to be any methods for adding a Comparator to an existing tree set. In real life you would read the documentation every time you use an unfamiliar class.
 
author & internet detective
Posts: 40246
819
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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. . . .


Oh! I missed the point of the errata report  until I read Campbell's comment. Yes. That would be better! Added to errata and credited Rade for finding it. (It's on page 70 of the printed book)
 
Get me the mayor's office! I need to tell her about this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic