Languages

Java create List of Strings in one line - how to do it?

3 points
Asked by:
Kate_C
21340

How can I create List of Strings without using multile line code in java?

I have List<String> like below:

List<String> list = new ArrayList<>();
list.add("1");
list.add("2");
list.add("3");

Is it possible to do it in 1 line?

0 answers
Native Advertising
­čÜÇ
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

ÔŁĄ´ŞĆ­čĺ╗ ­čÖé

Join