Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Another errata entry to SCJP Study Guide 1.4?

 
John Brown
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At page 427 of the SCJP Study Guide (1.4) by Kathy Sierra and Bert Bates, one can read about LinkedHashSet the following:
LinkedHashSet lets you iterate through the elements in the
order in which they were inserted. Optionally, you can construct a LinkedHashSet so that it maintains the order in which elements were last accessed, rather than the order in which elements were inserted.


What are the constructors/methods that let you construct a LinkedHashSet "so that it maintains the order in which elements were last accessed"?, cause I could not find anything in the API. All the API says is:

This linked list defines the iteration ordering, which is the order in which elements were inserted into the set insertion-order).


Its constructors are:

LinkedHashSet() - Constructs a new, empty linked hash set with the default initial capacity (16) and load factor (0.75).

LinkedHashSet(Collection c) - Constructs a new linked hash set with the same elements as the specified collection.

LinkedHashSet(int initialCapacity) - Constructs a new, empty linked hash set with the specified initial capacity and the default load factor (0.75).

LinkedHashSet(int initialCapacity, float loadFactor) - Constructs a new, empty linked hash set with the specified initial capacity and load factor.

I see nothing like LinkedHashMap's contructor that lets you construct the map so that is order by access:

LinkedHashMap(int initialCapacity, float loadFactor, boolean accessOrder) - Constructs an empty LinkedHashMap instance with the specified initial capacity, load factor and ordering mode.
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey John -

Somehow you got a hold of a REALLY old copy of the book, because that's an errata we fixed a long time ago. If you just got this book I'd go back to the bookstore and ask for a newer printing - this one should have dust-binned over a year ago

hth,

Bert
 
John Brown
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bert, yeah, I have the oldest book, in fact, it's THE first copy printed
But I've searched the errata (http://books.mcgraw-hill.com/downloads/products/0072226846/0072226846_errata.txt) last updated March 3 2003, and couldn't find anything. Is there another newer errata somewhere ?
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey John,

I dug up an additional errata document that didn't make it on the Osborne page - sorry! As a temporary kludge I added it to the wickedlysmart site - I'm making a new thread called "Additional errata for the old K&B" with a link to these additional errata. Thanks for bringing this up!

Bert
 
John Brown
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your welcome And thank you too for finding the additional errata.
 
Silviu Busu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

my books, SCJP 1.4, seems to have 2003 copyright, so I guess it's not updated to the lates errata.
I found some unexpected stuff after reading the first chapter and passing the first SELF Test.
please post a valid link with the complete errata.
I don't want to post stupid, old things.

thank you,
silviu busu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic