NameGraph
come out with a result of 0?
init
vs. run
.
NameGraph
appears with no grid lines in it, but then later when I search for a name, the grid lines appear? getWidth
and getHeight
methods return 0
if you call them from init
.
So if you are initializing the state of your NameGraph
in your NameSurfer
's init
method and drawing lines on it at that time, they won't draw in the right place.
The issue doesn't occur if you check for the width or height in your run
method.
Your name graph is supposed to have an update
method that redraws the graph, so try calling that from your NameSurfer
's run
method.
HashMap
to store the names in my database.
But I don't understand how to use it or why it is helpful.
HashMap
allows you to quickly search for something based on a "key" piece of information.
Our intention is that you would create a map where the keys are baby names and the values are Person
objects representing the person with that name.
Gender matters, so you'll have to think about how to incorporate gender into your map(s) properly.
ranks.txt
file?
Person
objects to put into the database.
So if you are wasting any memory in the Person
object, the issue is compounded to a great degree.
Don't store any unnecessary data fields in each Person
; for example, don't store a Scanner
as a field.
Some students report better performance when they change the data structure being used inside the Person
class, too.