[brailleblaster] Re: doesn't compile -- was: Re: Re: so Sina...

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <brailleblaster@xxxxxxxxxxxxx>
  • Date: Mon, 13 Dec 2010 20:37:49 -0500

Laura,

Just examine the string. This one you should be able to figure out on your own.

List<String> = java.util.Arrays.toList(args);

There's no variable name there.

Modify it to read:

List<String> l = java.util.Arrays.toList(args);

And please, for the love of good code, don't hard code java.util.Arrays, but 
instead import it, *smile*.

Take care,
Sina
-----Original Message-----
From: brailleblaster-bounce@xxxxxxxxxxxxx 
[mailto:brailleblaster-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
Sent: Monday, December 13, 2010 8:29 PM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] doesn't compile -- was: Re: Re: so Sina...

I checked and doublechecked your string and typed it carefully but javac 
doesn't accept it.  It says toList undefined in class
Arrays.
There is something wrong about that statement.  It doesn't specify the type of 
the elements of the array/list.  Shouldn't there be
somewhere to specify String explicitly?
Back to the docs, unless you have another suggestion.
--le

----- Original Message -----
From: "qubit" <lauraeaves@xxxxxxxxx>
To: <brailleblaster@xxxxxxxxxxxxx>
Sent: Monday, December 13, 2010 7:15 PM
Subject: [brailleblaster] Re: so Sina...


Aha! Thanx, that will do it!
--le

----- Original Message ----- 
From: "Chris von See" <chris@xxxxxxxxxxxxx>
To: <brailleblaster@xxxxxxxxxxxxx>
Sent: Monday, December 13, 2010 7:13 PM
Subject: [brailleblaster] Re: so Sina...


Try using this:

public static void main(String[] args)
{
List<String> = java.util.Arrays.toList(args);
}




On Dec 13, 2010, at 5:08 PM, qubit wrote:

> I guess I'm missing something in your answer.  On the one hand you
> say I
> can't initialize List<String> list with an array without a loop, (I
> can
> handle that), but then you say
>
>> You can feed that array to various lists which will > take an
>> array, and
>> then you'll have it as a list.
>
> Are you saying that there is a feed method in class ArrayList that
> will take
> the whole arg list array?
> Or are you saying I can pass an ArrayList<String as an arg that
> takes an
> array, or args to something that takes an ArrayList<String>?
> (Obviously the
> last does not work.)
>
> The point is that I have a method in Process or ProcessBuilder (I
> don't
> remember which) that takes a List<String>, so I am naturally
> assuming that
> that is easier to come by.
>
> Oh, heck, I may just post the files without testing, but I figured
> it would
> save someone else a little pain if I got them to work.
>
> Anyone who wants to enlighten my misunderstanding of java please
> comment.
> Thanx.
> --le
>
>
>
> ----- Original Message -----
> From: "Sina Bahram" <sbahram@xxxxxxxxx>
> To: <brailleblaster@xxxxxxxxxxxxx>
> Sent: Monday, December 13, 2010 5:07 PM
> Subject: [brailleblaster] Re: so Sina...
>
>
> You don't. it comes in as an array.
>
> You can feed that array to various lists which will take an array,
> and then
> you'll have it as a list.
>
> Take care,
> Sina
>
> -----Original Message-----
> From: brailleblaster-bounce@xxxxxxxxxxxxx
> [mailto:brailleblaster-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
> Sent: Monday, December 13, 2010 5:56 PM
> To: brailleblaster@xxxxxxxxxxxxx
> Subject: [brailleblaster] so Sina...
>
> If I can mix and match ByteArrays, what's wrong with this, and how
> do I get
> a List<String> out of args without a loop?
> And you think C++ is a tortuous pain...
> --le
>
>
>
>





Other related posts: