How to convert an array to linked list(implement) in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to convert an array to linked list(implement) in java?

Game entry to display the top 10 scores in array i have an assignment to change it into linked list without using the build-in classes.(implement).

6th Dec 2016, 5:08 PM
Rahaf Shiqdar
Rahaf Shiqdar - avatar
3 Answers
+ 1
To convert an array into a java.util.LinkedList we can use the java.util.Arrays class’s asList()method. The Arrays class in the java.util package provides a utility method to convert an array to a List. The Arrays.asList() method will convert an array to a fixed size List. To create a LinkedList, we just need to pass the List to the constructor of the java.util.LinkedList class.
6th Dec 2016, 5:25 PM
Vipul Walia
Vipul Walia - avatar
0
yes thank you i know this, but the assignment about creating the linked list not using the utilities.
6th Dec 2016, 5:36 PM
Rahaf Shiqdar
Rahaf Shiqdar - avatar
0
We can convert arary to linkedlist using three ways 1. Arrays.asList() 2. Collections.addAll() 3. add() method you can see code example here visit -->>https://www.javavogue.com/2015/05/how-convert-array-to-linkedlist.html/
18th Jan 2021, 5:12 PM
shubham