June 2018
Beginner
722 pages
18h 47m
English
The Set interface provides only one method for adding a single element:
The Objects class is a utility class located in the package java.util. Its equals() method compares two objects in a null-safe manner by returning true when both objects are null and using the equals() method otherwise. We will talk more about utility class Objects in this chapter in an upcoming section.
The add() method can throw a RuntimeException if something goes wrong. So, putting a try-catch block around the method makes the code more robust (if the catch block does not simply rethrow the ...
Read now
Unlock full access