Example usage for java.util Hashtable values

List of usage examples for java.util Hashtable values

Introduction

In this page you can find the example usage for java.util Hashtable values.

Prototype

Collection values

To view the source code for java.util Hashtable values.

Click Source Link

Usage

From source file:Main.java

public static void main(String[] args) {
    Hashtable<String, String> ht = new Hashtable<String, String>();
    ht.put("1", "One");
    ht.put("2", "Two");
    ht.put("3", "Three");

    Collection c = ht.values();
    Iterator itr = c.iterator();/*  www . j  a  va  2 s  . c o m*/
    while (itr.hasNext()) {
        System.out.println(itr.next());
    }
    c.remove("One");

    Enumeration e = ht.elements();

    while (e.hasMoreElements()) {
        System.out.println(e.nextElement());
    }
}

From source file:Main.java

public static void main(String args[]) {
    // create hash table 
    Hashtable<Integer, String> htable1 = new Hashtable<Integer, String>();

    // put values in table
    htable1.put(1, "A");
    htable1.put(2, "B");
    htable1.put(3, "C");
    htable1.put(4, "from java2s.com");

    System.out.println("Collection view of hash table: " + htable1.values());
}

From source file:MainClass.java

public static void main(String[] s) {
    Hashtable table = new Hashtable();
    table.put("key1", "value1");
    table.put("key2", "value2");
    table.put("key3", "value3");

    Enumeration e = table.elements();
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        System.out.println(key + " : " + table.get(key));
    }//from w w  w .ja  v  a  2  s .  com

    System.out.println(table.values());
}

From source file:Main.java

public static void main(String[] s) {
    Hashtable<String, String> table = new Hashtable<String, String>();
    table.put("key1", "value1");
    table.put("key2", "value2");
    table.put("key3", "value3");

    Enumeration e = table.elements();
    while (e.hasMoreElements()) {
        String key = (String) e.nextElement();
        System.out.println(key + " : " + table.get(key));
    }//from  w  w  w  . j ava 2  s. c  o m

    System.out.println(table.values());
}

From source file:com.projity.configuration.Dictionary.java

public static Object[] getAll(Object category) {
    Hashtable subMap = (Hashtable) getInstance().mainMap.get(category);
    Object[] array = subMap.values().toArray();
    Arrays.sort(array, namedItemComparator);
    return array;

}

From source file:org.eclipse.smila.search.templates.NodeTransformerRegistryController.java

/**
 * @return DNodeTransformerRegistry//from  www . j  a v a 2 s .c  o m
 */
public static DNodeTransformerRegistry getNodeTransformer() {
    final Log log = LogFactory.getLog(NodeTransformerRegistryController.class);
    final Hashtable<String, NodeTransformerType> nodeTransformers = NodeTransformerType.getTypes();
    final DNodeTransformerRegistry registry = new DNodeTransformerRegistry();
    for (final NodeTransformerType nodeTransformerType : nodeTransformers.values()) {
        final DNodeTransformer nt = new DNodeTransformer();
        nt.setClassName(nodeTransformerType.getClass().getName());
        nt.setDescription(nodeTransformerType.getName());
        nt.setName(nodeTransformerType.getName());
        try {
            nt.setParameterDefinition(nodeTransformerType.getParameterDefinition());
        } catch (final NodeTransformerException exception) {
            if (log.isErrorEnabled()) {
                log.error(exception);
            }
        }
        registry.addNodeTransformer(nt);
    }

    return registry;
}

From source file:Main.java

public static <ValueType> ArrayList<ValueType> getArrayList(Hashtable<?, ValueType> hashTable) {

    // /////////////////////////////////////////
    // Declarations:
    // /////////////////////////////////////////

    ArrayList<ValueType> newList = null;

    // /////////////////////////////////////////
    // Code:/*from w w w  . j  av a2  s  . co  m*/
    // /////////////////////////////////////////

    newList = new ArrayList<ValueType>(hashTable.size());
    newList.addAll(hashTable.values());

    return newList;

}

From source file:com.kevinquan.google.activityrecoginition.model.MotionHelper.java

public static List<MotionSnapshot> parseMotionSnapshots(Cursor result, final boolean sortDescending) {
    if (!CursorUtils.hasResults(result)) {
        Log.d(TAG, "No results were provided to parse motion snapshots from");
        return new ArrayList<MotionSnapshot>();
    }/*  ww w  .j  a v  a  2s. c o  m*/
    Hashtable<Long, MotionSnapshot> snapshots = new Hashtable<Long, MotionSnapshot>();

    do {
        Motion thisMotion = new Motion(result);
        if (thisMotion.getTimestamp() == 0) {
            Log.w(TAG, "Current motion seems corrupt: " + thisMotion);
            continue;
        }
        if (!snapshots.containsKey(thisMotion.getTimestamp())) {
            MotionSnapshot snapshot = new MotionSnapshot(thisMotion);
            snapshots.put(snapshot.getTimestamp(), snapshot);
        } else {
            if (!snapshots.get(thisMotion.getTimestamp()).addMotion(thisMotion)) {
                Log.w(TAG, "Could not add motion to snapshot: " + thisMotion.toString());
            }
        }
    } while (result.moveToNext());

    List<MotionSnapshot> results = new ArrayList<MotionSnapshot>();
    results.addAll(snapshots.values());
    Collections.sort(results, new Comparator<MotionSnapshot>() {
        @Override
        public int compare(MotionSnapshot lhs, MotionSnapshot rhs) {
            int result = ((Long) lhs.getTimestamp()).compareTo((Long) rhs.getTimestamp());
            return sortDescending ? -1 * result : result;
        }
    });
    return results;
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.wbuploader.UploadData.java

/**
 * @param row// ww w. j  av  a  2  s  . c  o m
 * @return true if all cells in row are blank
 */
public boolean isEmptyRow(int row) {
    if (row < 0 || row >= getRows()) {
        return true;
    }

    WorkbenchRow wbrow = getWbRow(row);
    Hashtable<Short, WorkbenchDataItem> items = wbrow.getItems();
    for (WorkbenchDataItem di : items.values()) {
        if (!StringUtils.isBlank(di.getCellData())) {
            return false;
        }
    }
    return true;
}

From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManagerCalibratorDefault.java

protected void hideControls() {
    Size displaySize = getDisplaySize();

    for (Hashtable<String, TexturedControl> pair : controls.values()) {
        for (TexturedControl control : pair.values()) {
            control.setPosition(new Point(displaySize.getWidth(), displaySize.getHeight()));
            control.setVisible(false);// ww  w.  j a v a 2s.  co  m
        }
    }
}