Problem

There is an alternative to creating a Command interface and then creating classes that imp...

There is an alternative to creating a Command interface and then creating classes that implement that interface when you wish to use the Command pattern in Java.  The alternative is to use the java.lang.reflect.Method class, each instance of which corresponds to a method in a class.  If this approach is used, then the ExtendedCollection interface can be redefined to include the following declaration:

 public void map(Object o, Method m)

This version of map repeatedly invokes the given method m on the given object o, using elements of the ExtendedCollection as the parameter to the method.  It only works if the method takes exactly one parameter.  If the method is static, then o is ignored and so it can be null.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 7
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT