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


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

hashtables syntax

From Popping mad <rainbow@colition.gov>
Newsgroups comp.lang.java.programmer
Subject hashtables syntax
Date 2016-05-15 06:31 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <nh954m$bu8$1@reader1.panix.com> (permalink)

Show all headers | View raw


This whole syntax is new and strange to me, seemingly illogical

   private static HashMap<String, Type[]> functions; // built-in
function types

    static { // initialize function types
        functions = new HashMap<>();
        functions.put("floor",      new Type[]{Type.FLOAT, Type.INT});
        functions.put("sqrt",       new Type[]{Type.FLOAT, Type.FLOAT});
        functions.put("log",        new Type[]{Type.FLOAT, Type.FLOAT,
Type.FLOAT});
        functions.put("random",     new Type[]{Type.FLOAT});
        functions.put("parseInt",   new Type[]{Type.STRING, Type.INT});
        functions.put("parseFloat", new Type[]{Type.STRING, Type.FLOAT});
        functions.put("readLine",   new Type[]{Type.STRING});
        functions.put("showInt",    new Type[]{Type.INT, Type.STRING});
        functions.put("showFloat",  new Type[]{Type.FLOAT, Type.STRING});
    }


If we are creating a private static Hashmap with template elements of a
String and and array of Types, then why do I have to call

functions = new HashMap<>();

and why nothing in the template.  And what does static do in this case?

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

hashtables syntax Popping mad <rainbow@colition.gov> - 2016-05-15 06:31 +0000
  Re: hashtables syntax Lew <lewbloch@gmail.com> - 2016-05-14 23:52 -0700
    Re: hashtables syntax Popping mad <rainbow@colition.gov> - 2016-05-15 10:23 +0000
      Re: hashtables syntax Lew <lewbloch@gmail.com> - 2016-05-15 09:33 -0700
        Re: hashtables syntax Lew <lewbloch@gmail.com> - 2016-05-15 09:35 -0700
      Re: hashtables syntax Eric Douglas <e.d.programmer@gmail.com> - 2016-05-16 06:10 -0700
  Re: hashtables syntax Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-15 07:44 -0400
    Re: hashtables syntax ruben safir <ruben@mrbrklyn.com> - 2016-05-16 01:26 -0400
      Re: hashtables syntax Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-16 07:48 -0400
        Re: hashtables syntax Steven Simpson <ss@my.domain.invalid> - 2016-05-16 15:51 +0100
          Re: hashtables syntax Steven Simpson <ss@my.domain.invalid> - 2016-05-16 22:35 +0100
      Re: hashtables syntax Lew <lewbloch@gmail.com> - 2016-05-16 16:10 -0700
  Re: hashtables syntax Andreas Leitgeb <avl@logic.at> - 2016-05-15 13:43 +0000
  Re: hashtables syntax Roedy Green <see_website@mindprod.com.invalid> - 2016-05-20 18:00 -0700

csiph-web