RE: java Lists

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 11 Dec 2010 19:53:46 -0500

Two things:

Convention calls it args, not arg, just like how in c, it's called argv.

Also, no you can not, because arg is an array, and an ArrayList is an object of 
type class ArrayList.

Autoboxing does exist in Java, but unfortunately, in that particular scenario, 
it doesn't.

However, things like ArrayList allow you to add entire arrays worth of contents 
into them, so all s not lost. Just look up the
various add methods.

Take care,
Sina

 

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
Sent: Saturday, December 11, 2010 6:34 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: java Lists

Can you do the following? --
public static void main( String[] arg ) {
    ArrayList<String> alist = arg;
}
--le

----- Original Message -----
From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, December 11, 2010 4:55 PM
Subject: RE: java Lists


Yes but an ArrayList is a subclass that is atually useful, and obviously if 
something takes a list, it will by definition, take an
ArrayList.

Note: an ArrayList is most often preferable to a Vector

Byte[] bytes = New Byte[100];

Take care,
Sina

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
Sent: Saturday, December 11, 2010 5:50 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: java Lists

Hi Sina -- I am using a list because that is what the method I am using 
required.
However, now it compiles. But I am having trouble throwing together a test 
for my package.  How do I allocate a byte array of 100
elements?  I am still thinking c and feel like I am always a little lost 
climbing around the java docs.
Any enlightenment welcome. Thanks!
--le


----- Original Message -----
From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Saturday, December 11, 2010 12:21 PM
Subject: RE: java Lists


It's in java.util; however, I wouldn't just use List, but rather a more
specific concept.

Take care,
Sina
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of qubit
Sent: Saturday, December 11, 2010 11:07 AM
To: bprogramming
Subject: java Lists

Greetings -- I am writing a java package that contains a method that has to
use class List<String>.  Unfortunately, I have gone
through a few screenfulls of docs, and although I find List under
Collections, I can't figure out what to import to get the
definition of List.
I spent yesterday and today battling with java docs and while I could
continue to look for this one, I am wondering if someone could
answer it off the top of their head.  I have tried  importing
java.Collections, java.lang.Collections, java.aut.List (that isn't the
right def).
Any info is welcome!
TIA
--le

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: