ArrayList Declaration and Assignment in one line


An ArrayList is a group of common elements. It is concrete implementation of List interface. ArrayList has ordered elements in which order they added.We can declare and assign elements to it in one line in various ways.



Output:
Sample ArrayList:: [one, two, three, four]
Stream Arraylist:: [abc, xyz]

Look at my other posts:

Some other interesting blogs:

Comments

Popular posts from this blog

List - Insertion order

Custom Stack Implementation in java

Custom LinkedList Implementation