本文整理汇总了Java中java.util.Map.containsValue方法的典型用法代码示例。如果您正苦于以下问题:Java Map.containsValue方法的具体用法?Java Map.containsValue怎么用?Java Map.containsValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Map
的用法示例。
在下文中一共展示了Map.containsValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processObject
import java.util.Map; //导入方法依赖的package包/类
public void processObject(IdEObject originObject, Map<Integer, IdEObject> result) {
if (result.containsValue(originObject)) {
return;
}
result.put(originObject.getExpressId(), originObject);
for (EStructuralFeature feature : originObject.eClass().getEAllStructuralFeatures()) {
if (getPackageMetaData().useForDatabaseStorage(originObject.eClass(), feature)) {
if (feature.isMany()) {
processList(originObject, feature, result);
} else {
Object value = originObject.eGet(feature);
if (feature.getEType() instanceof EClass) {
if (value != null) {
IdEObject referencedObject = (IdEObject) value;
processObject(referencedObject, result);
}
}
}
}
}
}
示例2: processList
import java.util.Map; //导入方法依赖的package包/类
public void processList(IdEObject originObject, EStructuralFeature feature, Map<Integer, IdEObject> result) {
if (result.containsValue(feature)) {
return;
}
if (feature.getEType() instanceof EClass) {
EList<?> list = (EList<?>) originObject.eGet(feature);
for (Object o : list) {
if (o != null) {
IdEObject listObject = (IdEObject) o;
if (feature.getEAnnotation("twodimensionalarray") != null) {
processList(listObject, feature, result);
} else {
processObject(listObject, result);
}
}
}
}
}
示例3: main
import java.util.Map; //导入方法依赖的package包/类
public static void main(String[] args) {
Map<TestEnum, Integer> map = new EnumMap<>(TestEnum.class);
map.put(TestEnum.e00, 0);
if (false == map.containsValue(0)) {
throw new RuntimeException("EnumMap unexpectedly missing 0 value");
}
if (map.containsValue(null)) {
throw new RuntimeException("EnumMap unexpectedly holds null value");
}
map.put(TestEnum.e00, null);
if (map.containsValue(0)) {
throw new RuntimeException("EnumMap unexpectedly holds 0 value");
}
if (false == map.containsValue(null)) {
throw new RuntimeException("EnumMap unexpectedly missing null value");
}
}
示例4: syncObservableFromCollectionValues
import java.util.Map; //导入方法依赖的package包/类
/**
* Synchronizes the {@link Collection} values to the supplied
* {@link Observable} {@link Map}
*
* @param fromCol
* the {@link Collection} that synchronization will derive
* from
* @param oc
* the {@link Observable} {@link Map} that should be
* synchronized to
* @return true when the synchronization resulted in a change to the
* {@link Collection}/{@link Map}
*/
private boolean syncObservableFromCollectionValues(
final Collection<Object> fromCol, final Map<Object, Object> oc) {
boolean changed = false;
boolean missing = false;
FieldProperty<?, ?, ?> fp;
Object fpv;
int i = -1;
for (final Object item : fromCol) {
fp = genFieldProperty(item, null);
fpv = fp != null ? fp.getDirty() : item;
missing = !oc.containsValue(fpv);
changed = !changed ? missing : changed;
if (collectionSelectionModel == null) {
oc.put(++i, fpv);
} else {
selectCollectionValue(fpv);
}
}
return changed;
}
示例5: addCapabilitiesTo
import java.util.Map; //导入方法依赖的package包/类
@Override
public void addCapabilitiesTo(DesiredCapabilities capabilities) {
Map<String, String> proxyProperties = getProxyProperties();
if (proxyProperties.size() == 0) {
return;
} else if (proxyProperties.containsValue("")) {
try {
throw new Exception(
"Proxy cannot be set. Please provide all settings " +
"needed to setup proxy connection.");
} catch (Exception e) {
e.printStackTrace();
return;
}
} else {
LOGGER.error("Setting proxy ...");
setProxyTo(capabilities, proxyProperties);
}
}
示例6: examineAliases
import java.util.Map; //导入方法依赖的package包/类
private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
String id,
Map<String, String> aliases) {
if (aliases.containsValue(id)) {
for (Map.Entry<String, String> entry : aliases.entrySet()) {
if (entry.getValue().equals(id)) {
String alias = entry.getKey();
String[] names = buildZoneStrings(tznp, locale, alias);
if (names != null) {
return names;
}
names = examineAliases(tznp, locale, alias, aliases);
if (names != null) {
return names;
}
}
}
}
return null;
}
示例7: containsValue
import java.util.Map; //导入方法依赖的package包/类
@Override
public boolean containsValue(@Nullable Object value) {
for (Map<C, V> row : rowMap().values()) {
if (row.containsValue(value)) {
return true;
}
}
return false;
}
示例8: findFulfillingNodes
import java.util.Map; //导入方法依赖的package包/类
/**
*
* @param vNode
* virtual node
* @param dem
* demand of the virtual node
* @param filtratedsNodes
* set of all nodes to extract the feasible substrate node
* candidates
*
* @return The set of substrate nodes accomplishing a demand
*/
public static List<SubstrateNode> findFulfillingNodes(VirtualNode vNode,
List<SubstrateNode> filtratedsNodes,
Map<VirtualNode, SubstrateNode> nodeMapping) {
List<SubstrateNode> nodes = new LinkedList<SubstrateNode>();
for (SubstrateNode n : filtratedsNodes) {
if (NodeLinkAssignation.isMappable(vNode, n)
&& !nodeMapping.containsValue(n)) {
nodes.add(n);
}
}
return nodes;
}
示例9: Subscribe
import java.util.Map; //导入方法依赖的package包/类
public void Subscribe( SubscriptionRequest req, Channel chan)
{
// Top level: get the sub map that hold the subscriptions for the relevant ecn
Map<String,Map<String,Channel>> ecnmap = null;
String ecn = req.getECN( );
if ( subscriptions.containsKey( ecn)) {
ecnmap = subscriptions.get( ecn);
}
else {
ecnmap = new HashMap<String,Map<String,Channel>>( );
subscriptions.put( ecn, ecnmap);
}
// Now let's find if there are existing subs for the instrument in question on this ecn
Map<String,Channel> submap = null;
String instrument = req.getInstrument( );
if ( ecnmap.containsKey( instrument)) {
submap = ecnmap.get( instrument);
}
else {
submap = new HashMap<String,Channel>( );
ecnmap.put(instrument, submap);
}
// Is there already an entry for this channel?
if ( submap.containsValue( chan)) {
logr.info( "StockTickerMessageHandler.Subscribe: " + ecn + " already has sub for " + instrument + " on " + chan.toString( ));
return;
}
JSON.MarketDataSubscriptionRequestMessage sreq = new JSON.MarketDataSubscriptionRequestMessage( ecn, instrument, chan);
try {
outQ.put( sreq);
}
catch (InterruptedException e) {
logr.info( "StockTickerMessageHandler.Subscribe: outQ.put( ) failed for "
+ ecn + ":" + instrument + "\n" + e.toString( ));
}
}
示例10: t9
import java.util.Map; //导入方法依赖的package包/类
static void t9(Map s) {
int sum = 0;
int iters = 20;
timer.start("ContainsValue (/n) ", iters * s.size());
int step = absentSize / iters;
for (int i = 0; i < absentSize; i += step)
if (s.containsValue(absent[i]))
++sum;
timer.finish();
reallyAssert(sum != 0);
}
示例11: onConnected
import java.util.Map; //导入方法依赖的package包/类
@Override
public void onConnected() {
Log.d(REACT_MODULE, "Health data service is connected.");
HealthPermissionManager pmsManager = new HealthPermissionManager(mModule.getStore());
mKeySet = new HashSet<PermissionKey>();
//mKeySet.add(new PermissionKey(HealthConstants.StepCount.HEALTH_DATA_TYPE, PermissionType.READ));
mKeySet.add(new PermissionKey(SamsungHealthModule.STEP_DAILY_TREND_TYPE, PermissionType.READ));
try {
// Check whether the permissions that this application needs are acquired
Map<PermissionKey, Boolean> resultMap = pmsManager.isPermissionAcquired(mKeySet);
if (resultMap.containsValue(Boolean.FALSE)) {
// Request the permission for reading step counts if it is not acquired
pmsManager.requestPermissions(mKeySet, mModule.getContext().getCurrentActivity()).setResultListener(
new PermissionListener(mModule, mErrorCallback, mSuccessCallback)
);
} else {
// Get the current step count and display it
Log.d(REACT_MODULE, "COUNT THE STEPS!");
mSuccessCallback.invoke(true);
}
} catch (Exception e) {
Log.e(REACT_MODULE, e.getClass().getName() + " - " + e.getMessage());
mErrorCallback.invoke("Permission setting fails");
}
}
示例12: validateGlobalResourceAccess
import java.util.Map; //导入方法依赖的package包/类
private static boolean validateGlobalResourceAccess(String globalName) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
while (cl != null) {
Map<String,String> registrations = globalResourceRegistrations.get(cl);
if (registrations != null && registrations.containsValue(globalName)) {
return true;
}
cl = cl.getParent();
}
return false;
}
示例13: t9
import java.util.Map; //导入方法依赖的package包/类
static void t9(Map s) {
int sum = 0;
int iters = 20;
timer.start("ContainsValue (/n) ", iters * s.size());
int step = absentSize / iters;
for (int i = 0; i < absentSize; i += step)
if (s.containsValue(absent[i])) ++sum;
timer.finish();
reallyAssert(sum != 0);
}
示例14: checkIfExporterShouldStart
import java.util.Map; //导入方法依赖的package包/类
private boolean checkIfExporterShouldStart(Object exporter, Map<Object, Boolean> importers) {
if (!importers.containsValue(Boolean.FALSE)) {
startExporter(exporter);
if (log.isDebugEnabled())
log.trace("Exporter [" + exporterToName.get(exporter) + "] started; "
+ "all its dependencies are satisfied");
return true;
} else {
List<String> unsatisfiedDependencies = new ArrayList<String>(importers.size());
for (Iterator<Map.Entry<Object, Boolean>> iterator = importers.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<Object, Boolean> entry = iterator.next();
if (Boolean.FALSE.equals(entry.getValue()))
unsatisfiedDependencies.add(importerToName.get(entry.getKey()));
}
if (log.isTraceEnabled()) {
log.trace("Exporter [" + exporterToName.get(exporter)
+ "] not started; there are still unsatisfied dependencies " + unsatisfiedDependencies);
}
return false;
}
}
示例15: validateParalleGatewaySenderIds
import java.util.Map; //导入方法依赖的package包/类
public void validateParalleGatewaySenderIds() throws PRLocallyDestroyedException {
for (String senderId : this.getParallelGatewaySenderIds()) {
for (PartitionRegionConfig config : this.prRoot.values()) {
if (config.getGatewaySenderIds().contains(senderId)) {
Map<String, PartitionedRegion> colocationMap =
ColocationHelper.getAllColocationRegions(this);
if (!colocationMap.isEmpty()) {
if (colocationMap.containsKey(config.getFullPath())) {
continue;
} else {
int prID = config.getPRId();
PartitionedRegion colocatedPR = PartitionedRegion.getPRFromId(prID);
PartitionedRegion leader = ColocationHelper.getLeaderRegion(colocatedPR);
if (colocationMap.containsValue(leader)) {
continue;
} else {
throw new IllegalStateException(
LocalizedStrings.PartitionRegion_NON_COLOCATED_REGIONS_1_2_CANNOT_HAVE_SAME_PARALLEL_GATEWAY_SENDER_ID_2
.toString(new Object[] {this.getFullPath(), config.getFullPath(),
senderId.contains(AsyncEventQueueImpl.ASYNC_EVENT_QUEUE_PREFIX)
? "async event queue" : "gateway sender",
senderId}));
}
}
} else {
throw new IllegalStateException(
LocalizedStrings.PartitionRegion_NON_COLOCATED_REGIONS_1_2_CANNOT_HAVE_SAME_PARALLEL_GATEWAY_SENDER_ID_2
.toString(new Object[] {this.getFullPath(), config.getFullPath(),
senderId.contains(AsyncEventQueueImpl.ASYNC_EVENT_QUEUE_PREFIX)
? "async event queue" : "gateway sender",
senderId}));
}
}
}
}
}