com.google.common.collect.SetMultimap#size ( )源码实例Demo

下面列出了com.google.common.collect.SetMultimap#size ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: cm_ext   文件: ReferenceValidatorImpl.java
@Override
public void beforeNode(Object obj, DescriptorPath path) {
  Preconditions.checkState(!refsStack.containsKey(path));

  SetMultimap<ReferenceType, String> refs = getRelatedPaths(obj, path);
  SetMultimap<ReferenceType, String> newRefs = LinkedHashMultimap.create();

  for (Map.Entry<ReferenceType, Collection<String>> entry : refs.asMap().entrySet()) {
    ReferenceType type = entry.getKey();
    for (String reference : entry.getValue()) {
      if (!allowedRefs.containsEntry(type, reference)) {
        newRefs.put(type, reference);
        allowedRefs.put(type, reference);
      }
    }
  }

  // consolidate into the singleton if it's empty
  newRefs = newRefs.size() == 0 ? ImmutableSetMultimap
      .<ReferenceType, String> of() : newRefs;
  refsStack.put(path, newRefs);

  callReferenceConstraints(obj, path);
}
 
源代码2 项目: gef   文件: SetMultimapExpression.java
@Override
public int size() {
	final SetMultimap<K, V> setMultimap = get();
	return (setMultimap == null) ? EMPTY_SETMULTIMAP.size()
			: setMultimap.size();
}