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:org.apache.hupa.server.preferences.InSessionUserPreferencesStorage.java

public Contact[] getContacts() {
    HttpSession session = sessionProvider.get();

    @SuppressWarnings("unchecked")
    HashMap<String, Contact> sessionContacts = (HashMap<String, Contact>) session
            .getAttribute(SConsts.CONTACTS_SESS_ATTR);

    return sessionContacts == null ? new Contact[] {}
            : sessionContacts.values().toArray(new Contact[sessionContacts.size()]);
}

From source file:es.wolfi.app.passman.VaultFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_vault_list, container, false);

    // Set the adapter
    if (view instanceof RecyclerView) {
        Context context = view.getContext();
        RecyclerView recyclerView = (RecyclerView) view;
        if (mColumnCount <= 1) {
            recyclerView.setLayoutManager(new LinearLayoutManager(context));
        } else {/*  ww w. ja  v  a  2 s  . c om*/
            recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
        }

        HashMap<String, Vault> vaults = (HashMap<String, Vault>) SingleTon.getTon()
                .getExtra(SettingValues.VAULTS.toString());
        ArrayList<Vault> l = new ArrayList<Vault>(vaults.values());
        recyclerView.setAdapter(new VaultViewAdapter(l, mListener));
    }
    return view;
}

From source file:io.crate.module.sql.benchmark.BulkDeleteBenchmark.java

@BenchmarkOptions(benchmarkRounds = BENCHMARK_ROUNDS, warmupRounds = 1)
@Test//  www. java  2  s . c om
public void testESBulkDelete() {
    HashMap<String, String> ids = createSampleData();
    Client client = getClient(false);
    BulkRequestBuilder request = new BulkRequestBuilder(client);

    for (String id : ids.values()) {
        DeleteRequest deleteRequest = new DeleteRequest("users", "default", id);
        request.add(deleteRequest);
    }
    request.execute().actionGet();
    refresh(client());
}

From source file:voldemort.ServerTestUtils.java

public static StoreDefinition getStoreDef(String storeName, int preads, int rreads, int pwrites, int rwrites,
        int zonereads, int zonewrites, HashMap<Integer, Integer> zoneReplicationFactor,
        HintedHandoffStrategyType hhType, String strategyType) {
    SerializerDefinition serDef = new SerializerDefinition("string");
    int replicationFactor = 0;
    for (Integer repFac : zoneReplicationFactor.values()) {
        replicationFactor += repFac;/*from  ww  w.  ja  v a 2s.com*/
    }
    return new StoreDefinitionBuilder().setName(storeName).setType(InMemoryStorageConfiguration.TYPE_NAME)
            .setKeySerializer(serDef).setValueSerializer(serDef).setRoutingPolicy(RoutingTier.SERVER)
            .setRoutingStrategyType(strategyType).setPreferredReads(preads).setRequiredReads(rreads)
            .setHintedHandoffStrategy(hhType).setZoneCountReads(zonereads).setZoneCountWrites(zonewrites)
            .setReplicationFactor(replicationFactor).setZoneReplicationFactor(zoneReplicationFactor)
            .setPreferredWrites(pwrites).setRequiredWrites(rwrites).build();
}

From source file:org.apache.ojb.broker.metadata.ConnectionRepository.java

public String toXML() {
    String eol = SystemUtils.LINE_SEPARATOR;
    // use copy to avoid sync problems
    HashMap map = (HashMap) jcdMap.clone();
    StringBuffer buf = new StringBuffer();
    Iterator it = map.values().iterator();
    while (it.hasNext()) {
        JdbcConnectionDescriptor jcd = (JdbcConnectionDescriptor) it.next();
        buf.append(jcd.toXML());/* ww  w . jav a 2  s .  co  m*/
        buf.append(eol);
    }
    return buf.toString();
}

From source file:org.apache.axis2.osgi.deployment.ModuleRegistry.java

public void unRegister(Bundle bundle, boolean uninstall) {
    lock.lock();// ww w  .jav  a 2 s. c o m
    try {

        List<AxisModule> moduleList = resolvedBundles.get(bundle);
        if (moduleList != null) {
            List<Long> stopBundleList = new ArrayList<Long>();
            for (AxisModule module : moduleList) {
                AxisConfiguration axisConfig = configCtx.getAxisConfiguration();
                for (Iterator iterator = axisConfig.getServiceGroups(); iterator.hasNext();) {
                    AxisServiceGroup axisServiceGroup = (AxisServiceGroup) iterator.next();
                    if (axisServiceGroup.isEngaged(module)) {
                        Long value = (Long) axisServiceGroup.getParameterValue(OSGi_BUNDLE_ID);
                        if (value != null) {
                            stopBundleList.add(value);
                        }
                    }
                }
                //
                HashMap serviceMap = axisConfig.getServices();
                Collection values = serviceMap.values();
                for (Object value1 : values) {
                    AxisService axisService = (AxisService) value1;
                    if (axisService.isEngaged(module)) {
                        Long value = (Long) axisService.getParameterValue(OSGi_BUNDLE_ID);
                        if (value != null && !stopBundleList.contains(value)) {
                            stopBundleList.add(value);
                        }
                    }
                    for (Iterator iterator1 = axisService.getOperations(); iterator1.hasNext();) {
                        AxisOperation axisOperation = (AxisOperation) iterator1.next();
                        if (axisOperation.isEngaged(module)) {
                            Long value = (Long) axisOperation.getParameterValue(OSGi_BUNDLE_ID);
                            if (value != null && !stopBundleList.contains(value)) {
                                stopBundleList.add(value);
                            }
                        }
                    }
                }
                Module moduleInterface = module.getModule();
                if (moduleInterface != null) {
                    try {
                        moduleInterface.shutdown(configCtx);
                    } catch (AxisFault e) {
                        String msg = "Error while shutting down the module : " + module.getName() + " : "
                                + module.getVersion() + " moduel in Bundle - " + bundle.getSymbolicName();
                        log.error(msg, e);
                    }
                }
                axisConfig.removeModule(module.getName(), module.getVersion());
                if (resolvedBundles.containsKey(bundle)) {
                    resolvedBundles.remove(bundle);
                }
                log.info("[Axis2/OSGi] Stopping :" + module.getName() + " : " + module.getVersion()
                        + " moduel in Bundle - " + bundle.getSymbolicName());
            }
            for (Long bundleId : stopBundleList) {
                Bundle unRegBundle = context.getBundle(bundleId);
                if (unRegBundle != null) {
                    serviceRegistry.unRegister(unRegBundle, false);
                }
            }
        }
    } finally {
        lock.unlock();
    }
}

From source file:org.apache.hupa.server.preferences.InImapUserPreferencesStorage.java

@Override
public Contact[] getContacts() {
    HashMap<String, Contact> sessionContacts = getContactsHash();
    return sessionContacts.values().toArray(new Contact[sessionContacts.size()]);
}

From source file:com.wms.studio.cache.lock.SyncLockMapCache.java

@Override
public Collection<V> values() {
    try {/*from  w ww.j  a va  2 s.c  om*/
        HashMap<K, V> attributes = memcachedClient.get(name);
        if (attributes != null) {
            Collection<V> values = attributes.values();
            if (!CollectionUtils.isEmpty(values))
                return Collections.unmodifiableCollection(values);
        }
    } catch (Exception e) {
        log.fatal("?MemCache,.", e);
    }
    return Collections.emptySet();
}

From source file:com.swiftnav.piksidroid.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    this.setupUI();

    UsbManager mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
    PendingIntent mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
    IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
    registerReceiver(mUsbReceiver, filter);

    filter = new IntentFilter(UsbManager.ACTION_USB_DEVICE_DETACHED);
    registerReceiver(mUsbReceiverDisconnect, filter);

    HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();

    for (UsbDevice device : deviceList.values()) {
        if ((device.getVendorId() == Utils.PIKSI_VID) && (device.getProductId() == Utils.PIKSI_PID))
            if (!mUsbManager.hasPermission(device)) {
                mUsbManager.requestPermission(device, mPermissionIntent);
            } else {
                ((EditText) findViewById(R.id.console)).setText("");
                piksiConnected(device);/*  w w  w .  j  a v  a  2s . co m*/
            }
    }
}

From source file:se.sawano.scala.examples.scalaspringmvc.Config.java

@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    HashMap<String, HttpMessageConverter<?>> defaultConverters = getDefaultMessageConverters();
    MappingJacksonHttpMessageConverter scalaConverter = createJsonMessageConverterWithScalaSupport();
    defaultConverters.put(scalaConverter.getClass().toString(), scalaConverter);

    converters.addAll(defaultConverters.values());
}