Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8799

Re: Substitute value in HashMap at runtime

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Substitute value in HashMap at runtime
Date 2011-10-14 09:40 -0700
Organization Canadian Mind Products
Message-ID <c7pg97ps78ojcsg7k038bqgeasint7b391@4ax.com> (permalink)
References <70a582b4-956b-4145-9cb8-ba8fbaf751f5@b10g2000vbc.googlegroups.com>

Show all headers | View raw


On Thu, 13 Oct 2011 05:18:57 -0700 (PDT), mike
<mikaelpetterson@hotmail.com> wrote, quoted or indirectly quoted
someone who said :

>How can I make my MyPreferences.getVariableValue() be evaluated at
>runtime? Any example?

What you need to do is create a HashMap( String, Lookup).

Your Lookup interface has a lookup method that does whatever
calculations/lookups you want.

see http://mindprod.com/jgloss/delegate.html

P.S. your code as is won't compile. There is a HashMap(Map<? extends
K, ? extends V> m)  constructor, but not one you are using.

The easiest way to fix the problem is to use a separate put method.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
It should not be considered an error when the user starts something
already started or stops something already stopped. This applies
to browsers, services, editors... It is inexcusable to 
punish the user by requiring some elaborate sequence to atone,
e.g. open the task editor, find and kill some processes.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

Substitute value in HashMap at runtime mike <mikaelpetterson@hotmail.com> - 2011-10-13 05:18 -0700
  Re: Substitute value in HashMap at runtime Lew <lewbloch@gmail.com> - 2011-10-13 05:53 -0700
  Re: Substitute value in HashMap at runtime Robert Klemme <shortcutter@googlemail.com> - 2011-10-13 06:44 -0700
    Re: Substitute value in HashMap at runtime Lew <lewbloch@gmail.com> - 2011-10-13 10:12 -0700
      Re: Substitute value in HashMap at runtime mike <mikaelpetterson@hotmail.com> - 2011-10-14 06:36 -0700
        Re: Substitute value in HashMap at runtime mike <mikaelpetterson@hotmail.com> - 2011-10-14 06:54 -0700
          Re: Substitute value in HashMap at runtime markspace <-@.> - 2011-10-14 08:13 -0700
  Re: Substitute value in HashMap at runtime Roedy Green <see_website@mindprod.com.invalid> - 2011-10-14 09:40 -0700

csiph-web