Win a copy of Rust Web Development this week in the Other Languages 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Chapter 3 review questions Two ArrayLists with the same content are equal (answer is wrong?)

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that the number of the questions are different per edition. In my book it is review question number 19 and it states that :
B. Two ArrayLists with the same content are equal.
is true according to the answer on page 341. But this should be false as the sequence matter.

For instance:
List<String> str1 = new ArrayList<>();
       str1.add("1");
       str1.add("2");
       List<String> str2 = new ArrayList<>();
       str2.add("2");
       str2.add("1");

       System.out.println("equals " + str1.equals(str2));//equals false
 
author & internet detective
Posts: 40913
840
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Liliane,
The order of the questions in the book is the same in any OCA 8 version. (The bonus exams online do not always have the same order.)

I consider "same content" to include order in an ArrayList since it is an ordered collection. Order doesn't matter/exist in a Set, but that's on the OCP 8.
reply
    Bookmark Topic Watch Topic
  • New Topic