List of usage examples for java.util Vector Vector
public Vector(Collection<? extends E> c)
From source file:Main.java
private static Vector vectorizedCollection(Collection p_collection) { return new Vector(p_collection); }
From source file:Main.java
public static <E> Vector<E> newVector(final Collection<? extends E> c) { return new Vector<E>(c); }
From source file:Main.java
public static <T> List<T> vector(T... source) { Vector<T> r = new Vector<T>(source.length); for (int i = 0; i < source.length; i++) { r.add(source[i]);/*from w w w. j av a 2s .com*/ } return r; }
From source file:Main.java
public static <E> Vector<E> newVector(final int initialCapacity) { return new Vector<E>(initialCapacity); }
From source file:Main.java
/** * Gets the reverse iterable of an Iterable (i.e. a collection). * If this collection implements ListIterator, then this operation is far more efficent. * Otherwise, the iterable is iterated through, where the results are stored, before * returning a iterable that iterates through the resulting list. * //from ww w. j a v a 2 s . c om * @param it * @return */ public static <T> Iterable<T> getReverse(Iterable<T> it) { if (it instanceof List) { //list takes up less computation and memory - use built in list iterator final ListIterator<T> iter = ((List<T>) it).listIterator(((List<T>) it).size()); return new Iterable<T>() { public Iterator<T> iterator() { return getReverseIterator(iter); } }; } int size = 10; if (it instanceof Collection) { //if not a list, but is a collection size = ((Collection<T>) it).size(); } List<T> list = new Vector<>(size); for (T t : it) { list.add(t); } final ListIterator<T> iter = list.listIterator(list.size()); return new Iterable<T>() { public Iterator<T> iterator() { return getReverseIterator(iter); } }; }
From source file:Main.java
/** * Create a Hash table from supplied Map, this is passed to Hessian encoder * to create Hessian encoded request body. * /*from w w w. j ava 2s. com*/ * @param map The source map. * @return Hash table from supplied Map. */ protected static Hashtable<String, Object> createHashTable(Map<String, List<String>> map) { Hashtable<String, Object> hashtable = new Hashtable<String, Object>(); Set<Map.Entry<String, List<String>>> set = map.entrySet(); for (Map.Entry<String, List<String>> obj : set) { hashtable.put(obj.getKey(), new Vector<String>(obj.getValue())); } return hashtable; }
From source file:SortedProperties.java
@Override public synchronized Enumeration<Object> keys() { Vector<Object> keyList = new Vector<Object>(super.keySet()); Collections.sort(keyList, comparator); return keyList.elements(); }
From source file:Main.java
public Main() { JTextField textField = new JTextField("A TextField"); textField.addFocusListener(this); JLabel label = new JLabel("A Label"); label.addFocusListener(this); add(label);/*from w w w . j a v a2 s . c om*/ String comboPrefix = "Item #"; final int numItems = 15; Vector vector = new Vector(numItems); for (int i = 0; i < numItems; i++) { vector.addElement(comboPrefix + i); } JComboBox comboBox = new JComboBox(vector); comboBox.addFocusListener(this); add(comboBox); JButton button = new JButton("A Button"); button.addFocusListener(this); add(button); JList list = new JList(vector); list.setSelectedIndex(1); list.addFocusListener(this); JScrollPane listScrollPane = new JScrollPane(list); listScrollPane.getVerticalScrollBar().setFocusable(false); listScrollPane.getHorizontalScrollBar().setFocusable(false); add(listScrollPane); setPreferredSize(new Dimension(450, 450)); }
From source file:Main.java
public Main() { JTextField textField = new JTextField("A TextField"); textField.addFocusListener(this); JLabel label = new JLabel("A Label"); label.addFocusListener(this); add(label);//from ww w . j a v a2s. co m String comboPrefix = "ComboBox Item #"; final int numItems = 15; Vector vector = new Vector(numItems); for (int i = 0; i < numItems; i++) { vector.addElement(comboPrefix + i); } JComboBox comboBox = new JComboBox(vector); comboBox.addFocusListener(this); add(comboBox); JButton button = new JButton("A Button"); button.addFocusListener(this); add(button); String listPrefix = "List Item #"; Vector listVector = new Vector(numItems); for (int i = 0; i < numItems; i++) { listVector.addElement(listPrefix + i); } JList list = new JList(listVector); list.setSelectedIndex(1); list.addFocusListener(this); JScrollPane listScrollPane = new JScrollPane(list); listScrollPane.getVerticalScrollBar().setFocusable(false); listScrollPane.getHorizontalScrollBar().setFocusable(false); add(listScrollPane); setPreferredSize(new Dimension(450, 450)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:gov.nih.nci.ncicb.cadsr.common.util.NCIBC4JUtil.java
public Vector getAllRows(RowIterator rowIterator) { Vector rows = new Vector(rowIterator.getRowCount()); try {/* ww w . ja v a 2 s .c o m*/ rowIterator.reset(); for (; rowIterator.hasNext(); rows.addElement(rowIterator.next())) ; rowIterator.reset(); } catch (Exception exception) { if (rowIterator != null) rowIterator.reset(); rows = new Vector(); } return rows; }