java版本的getorcreate_Java ContainerUtil.getOrCreate方法代碼示例
本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.getOrCreate方法的典型用法代碼示例。如果您正苦於以下問題:Java ContainerUtil.getOrCreate方法的具體用法?Java ContainerUtil.getOrCreate怎麼用?Java ContainerUtil.getOrCreate使用的例子?那麼恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.util.containers.ContainerUtil的用法示例。
在下文中一共展示了ContainerUtil.getOrCreate方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: increment
?點讚 3
?
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public synchronized void increment(@NotNull String groupName,
@NotNull NotificationSource source,
@NotNull NotificationCategory category,
@NotNull ProjectSystemId projectSystemId) {
final TObjectIntHashMap counter =
ContainerUtil.getOrCreate(
ContainerUtil.getOrCreate(
ContainerUtil.getOrCreate(
map,
projectSystemId,
ContainerUtil.>>newHashMap()),
groupName,
ContainerUtil.>newHashMap()
),
source,
new MyTObjectIntHashMap()
);
if (!counter.increment(category)) counter.put(category, 1);
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,
示例2: remove
?點讚 3
?
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public synchronized void remove(@Nullable final String groupName,
@NotNull final NotificationSource notificationSource,
@NotNull final ProjectSystemId projectSystemId) {
final Map>> groupMap =
ContainerUtil.getOrCreate(
map,
projectSystemId,
ContainerUtil.>>newHashMap());
if (groupName != null) {
final TObjectIntHashMap counter = ContainerUtil.getOrCreate(
ContainerUtil.getOrCreate(
groupMap,
groupName,
ContainerUtil.>newHashMap()
),
notificationSource,
new MyTObjectIntHashMap()
);
counter.clear();
}
else {
for (Map> sourceMap : groupMap.values()) {
sourceMap.remove(notificationSource);
}
}
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,
示例3: getState
?點讚 3
?
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public Map> getState() {
final Map> result = ContainerUtil.newHashMap();
Consumer consumer = new Consumer() {
@Override
public void consume(PostfixTemplateCheckedTreeNode template) {
if (!template.isChecked()) {
Set templatesForLanguage =
ContainerUtil.getOrCreate(result, template.getLang(), PostfixTemplatesSettings.SET_FACTORY);
templatesForLanguage.add(template.getTemplate().getKey());
}
}
};
visit(consumer);
return result;
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,
示例4: checkList
?點讚 3
?
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
public SvnMergeInfoCache.MergeCheckResult checkList(@NotNull final SvnChangeList list, final String branchPath) {
synchronized (myCalculatedLock) {
SvnMergeInfoCache.MergeCheckResult result;
final long revision = calculateCopyRevision(branchPath);
if (revision != -1 && revision >= list.getNumber()) {
result = SvnMergeInfoCache.MergeCheckResult.COMMON;
}
else {
result = ContainerUtil.getOrCreate(myAlreadyCalculatedMap, list.getNumber(), new Factory() {
@Override
public SvnMergeInfoCache.MergeCheckResult create() {
return checkAlive(list, branchPath);
}
});
}
return result;
}
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,
示例5: createFileProvider
?點讚 2
?
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
private static ISVNStatusFileProvider createFileProvider(@NotNull Map nonRecursiveMap) {
final Map> result = ContainerUtil.newHashMap();
for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
File file = item.getDir().getIOFile();
Map fileMap = ContainerUtil.getOrCreate(result, file.getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);
for (FilePath path : item.getChildrenList()) {
fileMap.put(path.getName(), path.getIOFile());
}
// also add currently processed file to the map of its parent, as there are cases when SVNKit calls ISVNStatusFileProvider with file
// parent (and not file that was passed to doStatus()), gets null result and does not provide any status
// see http://issues.tmatesoft.com/issue/SVNKIT-567 for details
if (file.getParentFile() != null) {
Map parentMap = ContainerUtil.getOrCreate(result, file.getParentFile().getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);
parentMap.put(file.getName(), file);
}
}
return new ISVNStatusFileProvider() {
@Override
public Map getChildrenFiles(File parent) {
return result.get(parent.getAbsolutePath());
}
};
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,
示例6: getChildren
?點讚 2
?
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
@Override
public Collection extends AbstractTreeNode> getChildren() {
final ServerConnection> connection = getConnection();
if (connection == null) {
return Collections.emptyList();
}
Map group2node = new HashMap();
final List children = new ArrayList();
for (Deployment deployment : connection.getDeployments()) {
final String groupName = deployment.getGroup();
if (groupName == null) {
children.add(new DeploymentNodeImpl(connection, this, deployment));
}
else {
Map groups
= ContainerUtil.getOrCreate(myServer2DeploymentGroups, getServer(), new Factory>() {
@Override
public Map create() {
return new HashMap();
}
});
final DeploymentGroup group
= ContainerUtil.getOrCreate(groups, groupName, new Factory() {
@Override
public DeploymentGroup create() {
return new DeploymentGroup(groupName);
}
});
ContainerUtil.getOrCreate(group2node, group, new Factory() {
@Override
public GroupNode create() {
GroupNode result = new GroupNode(connection, RemoteServerNode.this, group);
children.add(result);
return result;
}
});
}
}
return children;
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:45,
示例7: disableTemplate
?點讚 2
?
import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public void disableTemplate(PostfixTemplate template, String langForProvider) {
Set state = ContainerUtil.getOrCreate(myLangToDisabledTemplates, langForProvider, SET_FACTORY);
state.add(template.getKey());
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,
注:本文中的com.intellij.util.containers.ContainerUtil.getOrCreate方法示例整理自Github/MSDocs等源碼及文檔管理平臺,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。
總結
以上是生活随笔為你收集整理的java版本的getorcreate_Java ContainerUtil.getOrCreate方法代碼示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java实验七输入输出流_实验六_Jav
- 下一篇: canopy算法 java_mahout