For the purposes of this exercise, the only data structures that need to be considered are: array, ArrayList, LinkedList, HashSet, TreeSet, HashMap, and TreeMap. For passing over the elements of a data structure, consider only Iterator and for loop.
Situation: You're implementing a free drawing tool that records were the mouse has moved. A MouseMotionListener is called every time the mouse moves, and you want to record the position, as a Point object, at each of these calls. You don't know how many Points you need to store, but it will sometimes be more than 1000. You will never need to edit this series of points.
Question: What data structure would be appropriate, and how could this data structure be used? Show the following:
m_linePoints, declaration and constructor call.
p, to the data structure.
void process(Point pt)for each element in the data structure.