Example usage for java.util HashMap values

List of usage examples for java.util HashMap values

Introduction

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

Prototype

public Collection<V> values() 

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:com.physicaroid.pocketduino.cordova.PocketDuino.java

private void getDeviceName(CallbackContext callbackContext) {
    Activity activity = cordova.getActivity();
    UsbManager mUsbManager = (UsbManager) activity.getSystemService(Context.USB_SERVICE);
    HashMap<String, UsbDevice> map = mUsbManager.getDeviceList();
    Iterator<UsbDevice> it = map.values().iterator();
    while (it.hasNext()) {
        UsbDevice device = it.next();//  w ww. j a va  2 s. co  m
        // use device info
        Log.v(POCKETDUINO, "!!!--- USB Device Name ---!!!");
        Log.v(POCKETDUINO, device.getDeviceName());
        Log.v(POCKETDUINO, "!!!--- USB Device Product ID ---!!!");
        Log.v(POCKETDUINO, Integer.toString(device.getProductId()));
        Log.v(POCKETDUINO, "!!!--- USB Device Vendor ID ---!!!");
        Log.v(POCKETDUINO, Integer.toString(device.getVendorId()));
        Log.v(POCKETDUINO, "!!!--- USB Device Hash Code ---!!!");
        Log.v(POCKETDUINO, Integer.toString(device.hashCode()));
    }
}

From source file:org.apache.hadoop.hive.ql.parse.MapReduceCompiler.java

@Override
protected void setInputFormat(Task<? extends Serializable> task) {
    if (task instanceof ExecDriver) {
        MapWork work = ((MapredWork) task.getWork()).getMapWork();
        HashMap<String, Operator<? extends OperatorDesc>> opMap = work.getAliasToWork();
        if (!opMap.isEmpty()) {
            for (Operator<? extends OperatorDesc> op : opMap.values()) {
                setInputFormat(work, op);
            }/*  w w  w.  j a va 2 s  .  c  o  m*/
        }
    } else if (task instanceof ConditionalTask) {
        List<Task<? extends Serializable>> listTasks = ((ConditionalTask) task).getListTasks();
        for (Task<? extends Serializable> tsk : listTasks) {
            setInputFormat(tsk);
        }
    }

    if (task.getChildTasks() != null) {
        for (Task<? extends Serializable> childTask : task.getChildTasks()) {
            setInputFormat(childTask);
        }
    }
}

From source file:com.bayesforecast.ingdat.vigsteps.vigmake.VigMakeStep.java

private void emitTree() {
    //VigMakeStepMeta meta = (VigMakeStepMeta) this.getStepMetaInterface(); 
    VigMakeStepData data = (VigMakeStepData) this.getStepDataInterface();

    Set<Date> processedDates = data.processedDates.keySet();
    HashMap<List<Object>, Item> items = data.items;

    logBasic("Fechas procesadas: " + processedDates.size());
    logBasic("Items procesados: " + items.size());

    for (Item item : items.values()) {
        data.stateInsertionAlgo.markAbsences(item, processedDates);
        data.stateInsertionAlgo.cleanStates(item);
        emitItem(data, item, true);/*  www  .  j  a  va 2  s  .  c o m*/
    }

}

From source file:com.nps.micro.UsbService.java

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Log.d(TAG, "Received start id " + startId + ": " + intent);
    List<String> devicesNames = new ArrayList<String>();
    int numberOfDevices = intent.getIntExtra(MainActivity.PACKAGE + '.' + "numberOfDevices", 0);
    for (int i = 0; i < numberOfDevices; i++) {
        devicesNames.add(intent.getStringExtra(MainActivity.PACKAGE + '.' + "device" + i));
    }/*  ww w  . j  av a2 s  .  c o  m*/
    HashMap<String, UsbDevice> deviceList = usbManager.getDeviceList();
    Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
    while (deviceIterator.hasNext()) {
        UsbDevice dev = deviceIterator.next();
        if (devicesNames.contains(dev.getDeviceName())) {
            devices.add(dev);
        }
    }
    initMicrocontrollers();
    status = new Status(getString(R.string.ready), false);
    return START_STICKY;
}

From source file:org.apache.lucene.index.collocations.CollocationExtractor.java

private void sortTopTermsAndAddToCollocationsIndexForThisTerm(CollocationIndexer collocationIndexer,
        HashMap<String, CollocationScorer> phraseTerms) throws IOException {
    TopTerms topTerms = new TopTerms(numCollocatedTermsPerTerm);
    for (CollocationScorer pt : phraseTerms.values()) {
        topTerms.insertWithOverflow(pt);
    }//from  w w  w .ja va 2 s .c  o  m
    CollocationScorer[] tops = new CollocationScorer[topTerms.size()];
    int tp = tops.length - 1;
    while (topTerms.size() > 0) {
        CollocationScorer top = (CollocationScorer) topTerms.pop();
        tops[tp--] = top;
    }
    for (int j = 0; j < tops.length; j++) {
        collocationIndexer.indexCollocation(tops[j]);
    }
}

From source file:com.twosigma.beakerx.inspect.Inspect.java

private InspectResult getInspectResult(int caretPosition, String methodName, String className,
        String everything) {/*from  ww w .ja  va2s  .co  m*/
    HashMap<String, ClassInspect> stringClassInspectHashMap = new SerializeInspect().fromJson(everything);
    InspectResult inspectResult = new InspectResult();
    ClassInspect classInspect = null;
    if (stringClassInspectHashMap.containsKey(className)) {
        classInspect = stringClassInspectHashMap.get(className);
    } else {
        for (ClassInspect cls : stringClassInspectHashMap.values()) {
            if (cls.getClassName().equals(className)) {
                classInspect = cls;
                break;
            }
        }
    }
    if (methodName == null && classInspect != null) {
        List<MethodInspect> constructors = classInspect.getConstructors();
        String classInfo = parseClassInfo(classInspect) + "\n\n" + parseMethodsInfo(constructors, "");
        inspectResult = new InspectResult(classInfo, caretPosition);
    } else {
        List<MethodInspect> methodInspectsList = classInspect == null ? null : classInspect.getMethods();
        if (methodInspectsList == null) {
            return new InspectResult();
        }
        List<MethodInspect> methods = methodInspectsList.stream()
                .filter(m -> m.getMethodName().equals(methodName)).collect(Collectors.toList());
        if (!methods.isEmpty()) {
            return new InspectResult(parseMethodsInfo(methods, className), caretPosition);
        }
    }
    return inspectResult;
}

From source file:net.evecom.androidecssp.activity.TaskListActivity.java

/**
 * /*  ww  w . ja v  a 2  s. c om*/
 */
private void initlist() {
    new Thread(new Runnable() {
        @Override
        public void run() {
            Message message = new Message();

            try {
                HashMap<String, String> hashMap = new HashMap<String, String>();
                hashMap.put("eventId", eventInfo.get("id").toString());
                hashMap.put("projectId", projectInfo.get("id").toString());
                System.out.println(hashMap.values().toArray().toString());
                resutArray = connServerForResultPost(
                        "jfs/ecssp/mobile/taskresponseCtr/getTaskByEventIdAndProjectId", hashMap);
            } catch (ClientProtocolException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            } catch (IOException e) {
                message.what = MESSAGETYPE_02;
                Log.e("mars", e.getMessage());
            }
            if (resutArray.length() > 0) {
                try {
                    taskInfos = getObjsInfo(resutArray);
                    if (null == taskInfos) {
                        message.what = MESSAGETYPE_02;
                    } else {
                        message.what = MESSAGETYPE_01;
                    }
                } catch (JSONException e) {
                    message.what = MESSAGETYPE_02;
                    Log.e("mars", e.getMessage());
                }
            } else {
                message.what = MESSAGETYPE_02;
            }
            Log.v("mars", resutArray);
            eventListHandler.sendMessage(message);

        }
    }).start();

}

From source file:edu.utexas.cs.tactex.utilityestimation.UtilityEstimatorDefaultForConsumption.java

private int numTotalSubscriptions(
        HashMap<TariffSpecification, HashMap<CustomerInfo, Double>> predictedCustomerSubscriptions) {
    int total = 0;
    for (HashMap<CustomerInfo, Double> cust2subs : predictedCustomerSubscriptions.values()) {
        for (Double subs : cust2subs.values()) {
            total += subs;//from   ww  w  .  ja va 2  s .co m
        }
    }
    return total;
}

From source file:cz.zcu.pia.social.network.frontend.components.login.ComponentRegister.java

/**
 * Confirm button function//w  ww  .j  a  va2 s.  co m
 * @param event click event
 */
protected void confirmButtonFunction(Button.ClickEvent event) {
    try {
        if (!group.isModified()) {
            return;
        }
        group.commit();
        if (!isValid()) {
            return;
        }
        proccesValues();
    } catch (Validator.EmptyValueException ex) {
        Notification.show(msgs.getMessage(ERROR_EMPTY), Notification.Type.ERROR_MESSAGE);
    } catch (Validator.InvalidValueException ex) {
        Notification.show(msgs.getMessage(ERROR_RANGE), Notification.Type.ERROR_MESSAGE);

    } catch (FieldGroup.CommitException e) {
        HashMap<Field<?>, Validator.InvalidValueException> map = (HashMap<Field<?>, Validator.InvalidValueException>) e
                .getInvalidFields();

        for (Validator.InvalidValueException ee : map.values()) {
            if (ee.getMessage().equals(msgs.getMessage(REQUIRED_ERROR))) {
                Notification.show(msgs.getMessage(REQUIRED_ERROR_NOT_EMPTY), Notification.Type.ERROR_MESSAGE);
                return;
            }

        }

    }
}

From source file:com.tacitknowledge.util.migration.DistributedJdbcMigrationLauncherFactoryTest.java

/**
 * Make sure we the right patches go in the right spot
 * /*  ww w .ja v  a 2s .c  o  m*/
 * @exception Exception if anything goes wrong
 */
public void testDistributedMigrationContextTargetting() throws Exception {
    int currentPatchLevel = 3;
    HashMap controlledSystems = ((DistributedMigrationProcess) launcher.getMigrationProcess())
            .getControlledSystems();

    // set the patch info store to report the current patch level
    setReportedPatchLevel(controlledSystems.values(), currentPatchLevel);
    // Now do the migrations, and make sure we get the right number of events
    MigrationProcess process = launcher.getMigrationProcess();
    process.doMigrations(currentPatchLevel, context);

    // The orders schema has four tasks that should go, make sure they did
    JdbcMigrationLauncher ordersLauncher = (JdbcMigrationLauncher) controlledSystems.get("orders");
    // FIXME need to test multiple contexts
    TestDataSourceMigrationContext ordersContext = (TestDataSourceMigrationContext) ordersLauncher.getContexts()
            .keySet().iterator().next();
    assertEquals("orders", ordersContext.getSystemName());
    assertTrue(ordersContext.hasExecuted("TestTask1"));
    assertTrue(ordersContext.hasExecuted("TestTask2"));
    assertTrue(ordersContext.hasExecuted("TestTask3"));
    assertTrue(ordersContext.hasExecuted("TestTask4"));

    // The core schema has three tasks that should not go, make sure they exist but did not go
    JdbcMigrationLauncher coreLauncher = (JdbcMigrationLauncher) controlledSystems.get("core");
    // FIXME need to test multiple contexts
    TestDataSourceMigrationContext coreContext = (TestDataSourceMigrationContext) coreLauncher.getContexts()
            .keySet().iterator().next();
    assertEquals(3, coreLauncher.getMigrationProcess().getMigrationTasks().size());
    assertEquals("core", coreContext.getSystemName());
    assertFalse(coreContext.hasExecuted("patch0001_first_patch"));
    assertFalse(coreContext.hasExecuted("patch0002_second_patch"));
    assertFalse(coreContext.hasExecuted("patch0003_third_patch"));
}