Creating a HashMap and Passing It As a Parameter in One Step



I don't know what this is called, but I know if I have a method like this:

public void setValues(String[] newValues) {
//Do a bunch of stuff
return;
}

That I can call it by building a String[] within the line that calls it,
like this:

setValues(new String[] {firstString, secondString, thirdString});

First, is there a name for creating an object like this just to pass as a
parameter?

Second, is there a way I can create a HashMap the same way, with just one
line, specifying 2-3 keys and their values?

Thanks!

Hal
.



Relevant Pages

  • Re: A Logical Model for Lists as Relations
    ... I am aware of the difference between the number zero and an empty list. ... contents of a set - yields a bunch, which also has a comma union ... is a string of length 4. ... Empty strings and empty lists? ...
    (comp.databases.theory)
  • Filling out HTML form w/ hidden and pre-selected fields
    ... I've scraped an HTML page and gotten back a string that looks like this: ... bunch of stuff I don't care about ...] ... Ideally, the hash would include the field type, form action URL, etc, ...
    (perl.beginners)
  • Re: What types should I use in this COM Interface
    ... lists or arrays of strings. ... There are plenty of ways to marshal an HWND, but the easiest and still bit-safe way is to use a HANDLE as the native type. ... BSTR SecondString ... void Foo(IntPtr hwnd, string firstString, string secondString, out stringfirstArray, out stringsecondArray); ...
    (microsoft.public.dotnet.framework.interop)
  • Re: How to assign a block of text to a string in C#
    ... Also if it comes down to it you could right a very basic program that auto ... >This is a bunch of text ... >that is assigned to string x ... Just adding all the quotes is tedious. ...
    (microsoft.public.dotnet.languages.csharp)
  • Opening filenames from a list in a spreadsheet
    ... I am writing a program for use at a bunch of sites around the world. ... uses several SAP extracts that are to be stored on the C: ... I know I need to use a string but am new to the world of strings. ... Dim CWDBXLS ...
    (microsoft.public.excel.programming)