本文整理匯總了Java中com.google.common.collect.BiMap.containsValue方法的典型用法代碼示例。如果您正苦於以下問題:Java BiMap.containsValue方法的具體用法?Java BiMap.containsValue怎麽用?Java BiMap.containsValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.BiMap
的用法示例。
在下文中一共展示了BiMap.containsValue方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: fixOids
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
private void fixOids(IdEObject idEObject, OidProvider oidProvider, BiMap<Long, IdEObject> temp) {
if (idEObject == null) {
return;
}
if (temp.containsValue(idEObject)) {
return;
}
((IdEObjectImpl) idEObject).setOid(oidProvider.newOid(idEObject.eClass()));
if (objects.containsValue(idEObject)) {
temp.put(idEObject.getOid(), idEObject);
}
for (EReference eReference : idEObject.eClass().getEAllReferences()) {
Object val = idEObject.eGet(eReference);
if (eReference.isMany()) {
List list = (List) val;
for (Object o : list) {
fixOids((IdEObject) o, oidProvider, temp);
}
} else {
fixOids((IdEObject) val, oidProvider, temp);
}
}
}
示例2: testKeyValueCheck
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
/**
* HashBiMap key, value 相關校驗
*/
@Test
public void testKeyValueCheck() {
BiMap<String, String> biMap = HashBiMap.create();
biMap.put("k1", "v1");
// 校驗 map 是否為空
boolean isBiMapEmpty = biMap.isEmpty();
System.out.println("isBiMapEmpty: " + isBiMapEmpty);
// 檢查某個key是否存在
boolean isKeyExists = biMap.containsKey("k1");
System.out.println("isKeyExists: " + isKeyExists);
// 檢查某個value是否存在
boolean isValueExists = biMap.containsValue("v1");
System.out.println("isValueExists: " + isValueExists);
}
示例3: fixOidsFlat
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
private void fixOidsFlat(IdEObject idEObject, OidProvider oidProvider, BiMap<Long, IdEObject> temp) {
if (idEObject == null) {
return;
}
if (temp.containsValue(idEObject)) {
return;
}
((IdEObjectImpl) idEObject).setOid(oidProvider.newOid(idEObject.eClass()));
if (objects.containsValue(idEObject)) {
temp.put(idEObject.getOid(), idEObject);
}
}
示例4: checkDoubleOidsPlusReferences
import com.google.common.collect.BiMap; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
private void checkDoubleOidsPlusReferences(BiMap<IdEObject, Long> done, IdEObject idEObject) {
if (idEObject == null) {
return;
}
if (idEObject.eClass().getEAnnotation("wrapped") != null) {
return;
}
if (done.containsKey(idEObject)) {
return;
}
if (done.containsValue(idEObject.getOid())) {
showBackReferences(idEObject);
IdEObject existing = done.inverse().get(idEObject.getOid());
showBackReferences(existing);
throw new RuntimeException("Double oid: " + idEObject.getOid() + " " + idEObject + ", " + existing);
}
done.put(idEObject, idEObject.getOid());
for (EReference eReference : idEObject.eClass().getEAllReferences()) {
if (eReference.isMany()) {
List list = (List) idEObject.eGet(eReference);
for (Object o : list) {
checkDoubleOidsPlusReferences(done, (IdEObject) o);
}
} else {
checkDoubleOidsPlusReferences(done, (IdEObject) idEObject.eGet(eReference));
}
}
}