Convert an Iterator to a List in Java
Last Updated :
11 Dec, 2018
Given an Iterator, the task is to convert it into List in Java.
Examples:
Input: Iterator = {1, 2, 3, 4, 5}
Output: {1, 2, 3, 4, 5}
Input: Iterator = {'G', 'e', 'e', 'k', 's'}
Output: {'G', 'e', 'e', 'k', 's'}
Below are the various ways to do so:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...