Game Development Reference
In-Depth Information
public void addCurrentCast(Actor... actors) {
if( actors.length > 1 ) {
CURRENT_CAST.addAll(Arrays.asList(actors));
} else {
CURRENT_CAST.add( actors[0] );
}
}
Figure 17-47 . Upgrade addCurrentCast() method in the CastingDirector class to accept a single object in parameter
list
It is important to note that we could also accomplish this objective by overloading
this .addCurrentCast() method as well. If you wanted to do this in this fashion, the Java
code would look like the following method bodies:
public void addCurrentCast( Actor... actors ) {
CURRENT_CAST. addAll (Arrays.asList( actors ));
}
 
Search WWH ::




Custom Search