Java Vector to toHashSet(Vector vector)

Here you can find the source of toHashSet(Vector vector)

Description

to Hash Set

License

Common Public License

Declaration

static HashSet toHashSet(Vector vector) 

Method Source Code

//package com.java2s;
/*// w  ww  .  j  a  v  a 2  s .c o  m
 // $Id: //open/mondrian/src/main/mondrian/olap/fun/FunUtil.java#18 $
 // (C) Copyright 2002 Kana Software, Inc.
 // This software is subject to the terms of the Common Public License
 // Agreement, available at the following URL:
 // http://www.opensource.org/licenses/cpl.html.
 // (C) Copyright 2002 Kana Software, Inc. and others.
 // All Rights Reserved.
 // You must accept the terms of that agreement to use this software.
 //
 // jhyde, 3 March, 2002
 */

import java.util.*;

public class Main {
    static HashSet toHashSet(Vector vector) {
        HashSet set = new HashSet();
        for (int i = 0, count = vector.size(); i < count; i++) {
            set.add(vector.elementAt(i));
        }
        return set;
    }

    /** Adds every element of <code>right</code> to <code>left</code>. **/
    static void add(Vector left, Vector right) {
        if (right == null) {
            return;
        }
        for (int i = 0, n = right.size(); i < n; i++) {
            final Object o = right.elementAt(i);
            left.addElement(o);
        }
    }
}

Related

  1. toArray(Vector v)
  2. toEnumeration(Vector options)
  3. toHashSetD(Vector vec)
  4. toIntArray(Vector vec)
  5. toIntArray(Vector vect)
  6. toPercent(Vector members, HashMap mapMemberToValue)