Java Code Examples for com.google.common.collect.SetMultimap#size()
The following examples show how to use
com.google.common.collect.SetMultimap#size() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReferenceValidatorImpl.java From cm_ext with Apache License 2.0 | 6 votes |
@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); }
Example 2
Source File: SetMultimapExpression.java From gef with Eclipse Public License 2.0 | 4 votes |
@Override public int size() { final SetMultimap<K, V> setMultimap = get(); return (setMultimap == null) ? EMPTY_SETMULTIMAP.size() : setMultimap.size(); }