How do I read Vector object using Enumeration?

package org.kodejava.example.util;

import java.util.Enumeration;
import java.util.Vector;

public class VectorEnumeration {

    public static void main(String[] args) {
        Vector data = new Vector();
        data.add("one");
        data.add("two");
        data.add("three");

        StringBuilder sb = new StringBuilder("data: ");

        //
        // Get the enumeration of the vector and check if the
        // enumeration contains more elements.
        //
        for (Enumeration enumeration = data.elements(); 
             enumeration.hasMoreElements();) {
            sb.append(enumeration.nextElement()).append(",");
        }

        //
        // Delete the last ","
        //
        sb.deleteCharAt(sb.length() - 1);
        System.out.println(sb.toString());
    }
}

Wayan Saryada

Programmer, runner, recreational diver, currently living in the island of Bali, Indonesia. Mostly programming in Java, creating web based application with Spring Framework, Hibernate / JPA.