Storing user Define class in Collection
Pay special attention to how the list is displayed in reverse. After the list is modified, litr points to the end of the list. (Remember, litr.hasNext() returns false when the end of the list has been reached.) To traverse the list in reverse, the program continues to use litr, but this time it checks to see whether it has a previous element. As long as does, that element is obtained and displayed. type of object, including objects of classes that you create. For example, consider the following example that uses a Linked List to store mailing addresses:
Working With Maps
As explained near IIw start of this chapter, in addition to collections. java :£ adds m”ps to java.util. A map is an object that stores associations between keys .ind values, or kevin pairs. Given a key, you can find its value. Both key!’ and values :ire objects. The keys must be unique. but the values mny he duplicated. a null key and nun values, others cannot.