當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。