本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.getOrElse方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.getOrElse方法的具体用法?Java ContainerUtil.getOrElse怎么用?Java ContainerUtil.getOrElse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.getOrElse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCount
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public synchronized int getCount(@Nullable final String groupName,
@NotNull final NotificationSource notificationSource,
@Nullable final NotificationCategory notificationCategory,
@NotNull final ProjectSystemId projectSystemId) {
int count = 0;
final Map<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> groupMap = ContainerUtil.getOrElse(
map,
projectSystemId,
Collections.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>emptyMap());
for (Map.Entry<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> entry : groupMap.entrySet()) {
if (groupName == null || groupName.equals(entry.getKey())) {
final TObjectIntHashMap<NotificationCategory> counter = entry.getValue().get(notificationSource);
if (counter == null) continue;
if (notificationCategory == null) {
for (int aCount : counter.getValues()) {
count += aCount;
}
}
else {
count += counter.get(notificationCategory);
}
}
}
return count;
}
示例2: isProviderEnabled
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private boolean isProviderEnabled(final String providerName) {
return ContainerUtil.getOrElse(mySettings, providerName, true);
}