Tagged: #arraylist

ArrayList vs Vector

ArrayList and Vector collections are used interchangeably for storing several items with the same type inside the memory. In this tutorial, we list the major similarities and differences between these 2 collections. 1- Similarities Both collections implement List interface, hence they expose similar operations for add, edit and delete operations. Both store their items in a dynamic Array inside the memory. Both...

Java – Convert comma-separated String to List

This tutorial shows several ways for converting a comma-separated String to a List in Java. 1- Java 7 With Java 7 and older versions, the typical way of converting a comma-separated String to a List is through splitting the String by the comma “,” delimiter and then generating a List using Arrays.asList() as the following:

2- Java 8 In...

Java – Convert Array to List

This tutorial shows several ways to convert Array to List in Java. 1- Arrays.asList You can convert an Array to List using Arrays.asList() utility method. This method accepts an array as input and returns a list as output.

The limitation of using this method is that it returns a fixed size list. You can just read and overwrite its...