Monday 14 December 2015

How to Convert Enumeration to Arraylist - Java Example

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 :


21 comments:

  1. wow this is the thing i was looking for

    ReplyDelete
  2. I have read your blog its very attractive and impressive. I like it your blog.




    Java 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

    ReplyDelete
  3. Thanks for sharing this program.It is really helpful.Continue sharing more like this.
    Regards,
    Java Training in Chennai | Java Training Institutes in Chennai | Java courses in Chennai

    ReplyDelete
  4. 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.
    Best hadoop training institute in chennai|Hadoop Training Chennai|Hadoop Training in Chennai

    ReplyDelete
  5. Hi, Really your post was very informative. Today's internet era learn Hadoop Online Training will helps you to reach your goal.Selenium Training

    ReplyDelete
  6. It's very best beneficial blogs.I read this subjects blog such a great blog and good sharing I'll be like this information post.
    Selenium Training in Chennai
    Selenium Training

    ReplyDelete
  7. Excellent blog.This was really helpful.I would like to read more about java.
    Regards,
    Salesforce Training in Chennai | Salesforce course in Chennai

    ReplyDelete
  8. 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

    ReplyDelete
  9. This blog is the general information for the feature. You got a good work for these blog. oracle training in chennai

    ReplyDelete
  10. Chennai'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

    ReplyDelete
  11. This 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.

    Ultimate Data Analytics Training Course

    ReplyDelete
  12. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post.
    A/B Testing: Validating Hypotheses for Enhanced User Experience

    ReplyDelete
  13. 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
    thank you for sharing this type of useful information. you can read this Java Enterprise Edition (EE) Development: Building Scalable Applications

    ReplyDelete