1

I am new to android and I've been trying to create a ListView example application, in which I've added items to Arraylist....

list.add("Item1");
list.add("Item2");
list.add("Item3");
.......

Is there any way in android to avoid typing "List" every Time....? I know there is something ,But I couldn't find out what the keyword is..

in VB I could write

with list
.add("Item1");
.add("Item2");

Thanks in adavance

Dev
  • 31
  • 5

2 Answers2

2

Actually, there isn't.. What you can do is use Arrays.asList(...) which you can pass any number of arguments to and you'll get a list with these items back

Toon Borgers
  • 3,638
  • 1
  • 14
  • 22
  • I thought There will some keyword that I can Use...:( Thanks for your answer :) – Dev Dec 23 '13 at 10:45
0

No, there's no Java equivalent of the Visual Basic with statement.

Check this question.

Community
  • 1
  • 1
Martin Marconcini
  • 26,875
  • 19
  • 106
  • 144