|
||
|
|||
|
I was wondering whether it was possible to have method calls as the value in a HashMap (or LinkedHashMap). For example, I'm designing a virtual PDA program for a uni assignment. One of my classes is a 'Menu' class which acts as sort of a template for the PDA class's menus. What I'm aiming for is a HashMap in the Menu class, where the key is the menu option (type String) and the value is the method called by selecting that option. The PDA class will then create a bunch of Menus, and fill each Menu's map with the Menu options and the methods called by those options.
Basically I think I want a field like this in the Menu class: private HashMap<String, [Method Call]> menuOptions And then have a method in the PDA class that does something like this: menuOptions.put("Option A", doSomething()); where 'Option A' is the name of the option, and 'doSomething()' is a method signature. Thanks in advance to anyone who can help me.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Declare a method | mohsendeveloper | Object Oriented Programming | 4 | 11-06-2009 08:18 AM |
| Display the content method? | rocafella5007 | What's Wrong With My Code? | 1 | 30-04-2009 04:46 PM |
| problem with nextLine() method... | mia_tech | File I/O & Other I/O Streams | 1 | 10-03-2009 08:14 AM |
| matches() method is not available in Jbuilder 4 IDE. | sah | Java SE APIs | 2 | 04-03-2009 10:32 AM |
| matches() method is not available in Jbuilder4 | sah | Java IDEs | 1 | 30-12-2008 11:30 AM |
|
100 most searched terms
Search Cloud
|
| 2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? |