This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Usually "deep" and "shallow" are used to refer to copying, not comparison. But by analogy, "deep" comparison would mean comparing two objects, and all the objects they reference as members, and all the objects they reference, etc. "Shallow" comparison, in contrast, would mean just comparing two objects, I suppose. Object.equals() does a "shallow" comparison, I suppose, but this is only because Object has no data members. Most implementations of equals() should do "deep" comparisons.
Like Ernest said, the reference is usually to "deep" and "shallow" copies. A shallow copy of an ArrayList would make a copy of the ArrayList object, but both ArrayLists would end up referencing the same objects as elements of the List. In other words, after a shallow copy the folloowing two statements should be true: originalList != copyOfList originalList.get(0) == copyOfList.get(0) By contrast, a deep copy of an ArrayList would not only copy the ArrayList object, but make copies of each of the elements as well (and copies of objects contained in each element object ad infinitum). After a deep copy, the collowing statements should hold true: originalList != copyOfList originalList.get(0) != copyOfList.get(0) originalList.get(0).equals(copyOfList.get(0)) From this you can probably intuitively understand the differences between shallow and deep comparisons. I guess a shallow comparison of an two ArrayLists would only compare the actual ArrayList objects, whereas a deep comparison would compare the ArrayList objects as well as each element of the ArrayLists.