Game Development Reference
In-Depth Information
gesting here is an optimization that will allow your CURRENT_CAST data store ob-
ject to remain where it is in memory all of the time (after it is created).
This does not mean that your List<Actor> ArrayList<Actor> object itself can't
change. Your game's Java code can expand, contract, and clear (reset) a List<Actor>
ArrayList<Actor> object that has been declared final at any time, based upon your
game's invocation of the .addCurrentCast(), .removeCurrentCast(), and .resetCur-
rentCast() methods.
The optimization theory here would be the more a JVM can “lock down” memory
locations “up front” (upon program launch, when loading into memory), the better it
can optimize memory, as well as the CPU cycles that are needed to access this memory.
If you think about it, if the CPU does not have to “look” for an object in memory, then
it will be able to access it faster. A final object can also be used more optimally in a
multi-threaded environment.
If, however, you do not want to make your object references final, you can option-
ally turn this feature off in NetBeans. This can be done using the Tools Options
menu sequence, seen on the left side of Figure 10-6 , in order to access the Options dia-
log, which is shown in the right side of Figure 10-6 . As you can see along the top of
this Options dialog, NetBeans has organized it's hundreds of preferences (also known
as options) into ten specific areas, and even has a Search Filter, seen at the top right of
the dialog as well, in case you don't know exactly where to look for a given option. If
any of these sections have too many options to display on the dialog screen, there will
be tabs (the hints tab is shown selected in Figure 10-6 ), which you can use to navigate
to an area you want to visit. We're going to the Hints section, and selecting the Java
Language from the drop-down, and then finally opening up the Threading section.
Figure 10-6 . Setting Editor Hints Preferences using the Tools
Options menu and the Editor
Hints
Java
Threading
 
 
Search WWH ::




Custom Search