We can convert enumeration to arraylist in java with the help list() method of Collections.
package javaproficeincy;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Vector;
public class EnumerationToList {
public static void main(String[] args) {
Vector<String> vt = new Vector<String>();
vt.add("java");
vt.add("php");
vt.add("array");
vt.add("string");
vt.add("c");
Enumeration<String> enm = vt.elements();
List<String> ll = Collections.list(enm);
System.out.println("List elements: "+ll);
}
}
Output:
List elements: [java, php, array, string, c]
Related Posts :
wow this is the thing i was looking for
ReplyDeletenice and really helpful article to everyone... thanks for sharing
ReplyDeleteselenium training in chennai | selenium training institute in chennai | Android training in chennai | android training institute in chennai
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeleteJava Training in Chennai Core Java Training in Chennai Core Java Training in Chennai
Java Online Training Java Online Training Core Java 8 Training in Chennai Java 8 Training in Chennai JavaEE Training in Chennai JavaEE Training in Chennai
Great and useful article.
ReplyDeleteSCM training in chennai
Thanks for sharing this program.It is really helpful.Continue sharing more like this.
ReplyDeleteRegards,
Java Training in Chennai | Java Training Institutes in Chennai | Java courses in Chennai
Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
ReplyDeleteBest hadoop training institute in chennai|Hadoop Training Chennai|Hadoop Training in Chennai
Hi, Really your post was very informative. Today's internet era learn Hadoop Online Training will helps you to reach your goal.Selenium Training
ReplyDeleteIt's very best beneficial blogs.I read this subjects blog such a great blog and good sharing I'll be like this information post.
ReplyDeleteSelenium Training in Chennai
Selenium Training
Excellent blog.This was really helpful.I would like to read more about java.
ReplyDeleteRegards,
Salesforce Training in Chennai | Salesforce course in Chennai
Good and informative post. keep updating.. Android Training Institute in Chennai | Android Training Institute in Velachery.
ReplyDeleteThanks for the sharing this post
ReplyDeletejoin sap course in gurgaon
Great and nice blog thanks for sharing..
ReplyDeleteBest Project Center in Chennai | Final Year Project Center in Chennai | No.1 Project Center in Chennai
Wonderful post. keep updating....CCNP Training Institute in Chennai | CCNP Training Institute in Velachery.
ReplyDeleteThank you for the informative post. It was thoroughly helpful to me. Web Designing Training Institute in Chennai | Web Designing Training Institute in Velachery.
ReplyDeleteThanks for sharing well blog Hadoop training in bangalore
ReplyDeleteTableau training in bangalore
Android training in bangalore
PHP training in bangalore
Nice blog, you have provided the right info that will be beneficial to somebody at all time. Thanks for sharing your valuable Ideas to our vision. No.1 CCNA Training in Chennai | No.1 CCNP Training in Chennai
ReplyDeleteThis blog is the general information for the feature. You got a good work for these blog. oracle training in chennai
ReplyDeleteChennai's No.1 software training institute, Infycle Technologies, provides the best Oracle DBA training in Chennai for students, freshers, and tech professionals along with other corporate courses such as Data Science, Cloud computing, DevOps, Digital Marketing, Python, Big Data, Selenium, Java, Hadoop, iOS, and Android development with 100% hands-on training. After the completion of training, the students will be sent for placement interviews in the core MNC's. Call 7504633633 to get more info and a free demo.Best Oracle DBA Training in Chennai | Infycle Technologies
ReplyDeleteThis Java example demonstrates converting an Enumeration to an ArrayList using the list() method from the Collections class. The code initializes a Vector with elements, then converts its Enumeration to an ArrayList, showcasing the ease of transitioning between these data structures. The concise code snippet effectively illustrates the process, making it a useful reference for developers seeking to perform such conversions in their projects, enhancing their understanding of Java collections.
ReplyDeleteUltimate Data Analytics Training Course
A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post.
ReplyDeleteA/B Testing: Validating Hypotheses for Enhanced User Experience
Honestly telling this blog is the best in learning the subject. after reading this blog post, I have learned more relative and valuable information, Great Job
ReplyDeletethank you for sharing this type of useful information. you can read this Java Enterprise Edition (EE) Development: Building Scalable Applications