当前位置: 首页>>代码示例>>Java>>正文


Java Map.containsValue方法代码示例

本文整理汇总了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);
					}
				} 
			}
		}
	}
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:22,代码来源:SplitIfcModel.java

示例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);
				}
				
			}
		}
	}
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:20,代码来源:SplitIfcModel.java

示例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");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:UniqueNullValue.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:34,代码来源:BeanPathAdapter.java

示例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);
    }
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:21,代码来源:ProxyFixture.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:TimeZoneNameUtility.java

示例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;
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:10,代码来源:AbstractTable.java

示例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;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:25,代码来源:MiscelFunctions.java

示例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( ));
    }
}
 
开发者ID:SpreadServe,项目名称:TFWebSock,代码行数:37,代码来源:SubscriptionHandler.java

示例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);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:12,代码来源:MapCheckJUnitTest.java

示例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");
    }
}
 
开发者ID:cellihealth,项目名称:react-native-samsung-health,代码行数:29,代码来源:ConnectionListener.java

示例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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:12,代码来源:ResourceLinkFactory.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:MapCheck.java

示例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;
		}
	}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:28,代码来源:DefaultMandatoryDependencyManager.java

示例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}));
        }

      }
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:38,代码来源:PartitionedRegion.java


注:本文中的java.util.Map.containsValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。