本文整理匯總了Java中com.google.common.collect.SetMultimap.keySet方法的典型用法代碼示例。如果您正苦於以下問題:Java SetMultimap.keySet方法的具體用法?Java SetMultimap.keySet怎麽用?Java SetMultimap.keySet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.SetMultimap
的用法示例。
在下文中一共展示了SetMultimap.keySet方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: filterHandelingen
import com.google.common.collect.SetMultimap; //導入方法依賴的package包/類
private Set<HandelingVoorPublicatie> filterHandelingen(final Set<Long> personenInLevering, final SetMultimap<Long, Long> admhndMap) {
final Set<HandelingVoorPublicatie> teLeverenHandelingen = new HashSet<>();
//loop over handelingen zonder status in levering en bepaal unieke bijgehouden persoon sets
for (Long admhnId : admhndMap.keySet()) {
final Set<Long> bijgehoudenPersonen = admhndMap.get(admhnId);
if (Collections.disjoint(bijgehoudenPersonen, personenInLevering)) {
final HandelingVoorPublicatie handelingVoorPublicatie = new HandelingVoorPublicatie();
handelingVoorPublicatie.setAdmhndId(admhnId);
handelingVoorPublicatie.setBijgehoudenPersonen(bijgehoudenPersonen);
teLeverenHandelingen.add(handelingVoorPublicatie);
personenInLevering.addAll(bijgehoudenPersonen);
} else {
LOGGER.debug(String.format("admhnd %s voor persoon al in levering, discard voor nu. Worden later opgepakt", admhnId));
}
}
return teLeverenHandelingen;
}
示例2: writeDependencyConfigurationMapping
import com.google.common.collect.SetMultimap; //導入方法依賴的package包/類
private void writeDependencyConfigurationMapping(IvyDependencyMetadata dep) throws IOException {
SetMultimap<String, String> confMappings = dep.getConfMappings();
writeCount(confMappings.keySet().size());
for (String conf : confMappings.keySet()) {
writeString(conf);
writeStringSet(confMappings.get(conf));
}
}
示例3: getLocalAndInheritedMethods
import com.google.common.collect.SetMultimap; //導入方法依賴的package包/類
/**
* Returns the set of all non-private methods from {@code type}, including methods that it
* inherits from its ancestors. Inherited methods that are overridden are not included in the
* result. So if {@code type} defines {@code public String toString()}, the returned set will
* contain that method, but not the {@code toString()} method defined by {@code Object}.
* <p/>
* <p>The returned set may contain more than one method with the same signature, if
* {@code type} inherits those methods from different ancestors. For example, if it
* inherits from unrelated interfaces {@code One} and {@code Two} which each define
* {@code void foo();}, and if it does not itself override the {@code foo()} method,
* then both {@code One.foo()} and {@code Two.foo()} will be in the returned set.
*
* @param type the type whose own and inherited methods are to be returned
* @param elementUtils an {@link Elements} object, typically returned by
* {@link javax.annotation.processing.AbstractProcessor#processingEnv processingEnv}<!--
* -->.{@link javax.annotation.processing.ProcessingEnvironment.getElementUtils()
* getElementUtils()}
*/
public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods(
TypeElement type, Elements elementUtils) {
SetMultimap<String, ExecutableElement> methodMap = LinkedHashMultimap.create();
getLocalAndInheritedMethods(getPackage(type), type, methodMap);
// Find methods that are overridden. We do this using `Elements.overrides`, which means
// that it is inherently a quadratic operation, since we have to compare every method against
// every other method. We reduce the performance impact by (a) grouping methods by name, since
// a method cannot override another method with a different name, and (b) making sure that
// methods in ancestor types precede those in descendant types, which means we only have to
// check a method against the ones that follow it in that order.
Set<ExecutableElement> overridden = new LinkedHashSet<ExecutableElement>();
for (String methodName : methodMap.keySet()) {
List<ExecutableElement> methodList = ImmutableList.copyOf(methodMap.get(methodName));
for (int i = 0; i < methodList.size(); i++) {
ExecutableElement methodI = methodList.get(i);
for (int j = i + 1; j < methodList.size(); j++) {
ExecutableElement methodJ = methodList.get(j);
if (elementUtils.overrides(methodJ, methodI, type)) {
overridden.add(methodI);
}
}
}
}
Set<ExecutableElement> methods = new LinkedHashSet<ExecutableElement>(methodMap.values());
methods.removeAll(overridden);
return ImmutableSet.copyOf(methods);
}
示例4: checkFieldInitialization
import com.google.common.collect.SetMultimap; //導入方法依賴的package包/類
/**
* check that all @NonNull fields of the class are properly initialized
*
* @param tree the class
* @param state visitor state
*/
private void checkFieldInitialization(ClassTree tree, VisitorState state) {
FieldInitEntities entities = collectEntities(tree, state);
Symbol.ClassSymbol classSymbol = ASTHelpers.getSymbol(tree);
class2Entities.put(classSymbol, entities);
// set of all non-null instance fields f such that *some* constructor does not initialize f
Set<Symbol> notInitializedInConstructors;
SetMultimap<MethodTree, Symbol> constructorInitInfo;
if (entities.constructors().isEmpty()) {
constructorInitInfo = null;
notInitializedInConstructors = entities.nonnullInstanceFields();
} else {
constructorInitInfo = checkConstructorInitialization(entities, state);
notInitializedInConstructors = ImmutableSet.copyOf(constructorInitInfo.values());
}
class2ConstructorUninit.putAll(classSymbol, notInitializedInConstructors);
Set<Symbol> notInitializedAtAll =
notAssignedInAnyInitializer(entities, notInitializedInConstructors, state);
SetMultimap<Element, Element> errorFieldsForInitializer = LinkedHashMultimap.create();
// non-null if we have a single initializer method
Symbol.MethodSymbol singleInitializerMethod = null;
if (entities.instanceInitializerMethods().size() == 1) {
singleInitializerMethod =
ASTHelpers.getSymbol(entities.instanceInitializerMethods().iterator().next());
}
for (Symbol uninitField : notInitializedAtAll) {
if (singleInitializerMethod != null) {
// report it on the initializer
errorFieldsForInitializer.put(singleInitializerMethod, uninitField);
} else if (constructorInitInfo == null) {
// report it on the field
fieldsWithInitializationErrors.add(uninitField);
} else {
// report it on each constructor that does not initialize it
for (MethodTree methodTree : constructorInitInfo.keySet()) {
Set<Symbol> uninitFieldsForConstructor = constructorInitInfo.get(methodTree);
if (uninitFieldsForConstructor.contains(uninitField)) {
errorFieldsForInitializer.put(ASTHelpers.getSymbol(methodTree), uninitField);
}
}
}
}
for (Element constructorElement : errorFieldsForInitializer.keySet()) {
initializerErrors.put(
constructorElement,
errMsgForInitializer(errorFieldsForInitializer.get(constructorElement)));
}
// For static fields
Set<Symbol> notInitializedStaticFields = notInitializedStatic(entities, state);
for (Symbol uninitSField : notInitializedStaticFields) {
// Always report it on the field for static fields (can't do @SuppressWarnings on a static
// initialization block
// anyways).
fieldsWithInitializationErrors.add(uninitSField);
}
}