Dump all the key from Hashmap to a vector

Posted on 2006-04-18
Last Modified: 2008-03-17
I wish to dump all the keys from Hashmap to a vector, how to do it?(The concern here is the performance, I wish to use the minimal resources to do this, however, any suggestion is welcome)
Question by:william007
    LVL 92

    Accepted Solution

    Vector v = new Vector(map.keySet());
    LVL 14

    Expert Comment

    I guess the best way would be to use the functions API provides:

    Vector v = new Vector();
    LVL 1

    Assisted Solution

    why do you need vector, use the set itself. You have all the power of the collections api on the Set too.
    LVL 30

    Assisted Solution

    >> The concern here is the performance

    BTW, I doubt if Vector will give you better performance than the set itself.
    LVL 9

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now