Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Dan682Lee

Dan682Lee

Community Learner
Active in: Java
Share
0Questions
1Answers
0Views on questions

Initialization of an ArrayList in one line

In Java, you can initialize an ArrayList in one line using different approaches depending on your needs. The most common are new ArrayList(Arrays.asList("A","B","C")) for a modifiable list, new ArrayList(List.of("A","B","C")) in Java 9+ for concise syntax, or Collections.addAll(new ArrayList(), "A","B","C") for clean…

Java

Answered Mar 9, 2026 · 1.1K Views Read answer →

More members from the Java community

Learners asking and answering questions on the same topics — follow their questions and join in.

Latest Java Blogs

Guides, tips and career advice on Java from JanBask experts.

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.