本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.intersection方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.intersection方法的具体用法?Java ContainerUtil.intersection怎么用?Java ContainerUtil.intersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.intersection方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMatchingHeads
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private Set<Integer> getMatchingHeads(@NotNull VcsLogRefs refs, @NotNull Set<VirtualFile> roots, @NotNull VcsLogFilterCollection filters) {
VcsLogBranchFilter branchFilter = filters.getBranchFilter();
VcsLogRootFilter rootFilter = filters.getRootFilter();
VcsLogStructureFilter structureFilter = filters.getStructureFilter();
if (branchFilter == null && rootFilter == null && structureFilter == null) return null;
Set<Integer> filteredByBranch = null;
if (branchFilter != null) {
filteredByBranch = getMatchingHeads(refs, branchFilter);
}
Set<Integer> filteredByFile = getMatchingHeads(refs, VcsLogUtil
.getAllVisibleRoots(roots, rootFilter, structureFilter));
if (filteredByBranch == null) return filteredByFile;
if (filteredByFile == null) return filteredByBranch;
return new HashSet<Integer>(ContainerUtil.intersection(filteredByBranch, filteredByFile));
}
示例2: getAllVisibleRoots
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static Set<VirtualFile> getAllVisibleRoots(@NotNull Collection<VirtualFile> roots,
@Nullable VcsLogRootFilter rootFilter,
@Nullable VcsLogStructureFilter structureFilter) {
if (rootFilter == null && structureFilter == null) return new HashSet<VirtualFile>(roots);
Collection<VirtualFile> fromRootFilter;
if (rootFilter != null) {
fromRootFilter = rootFilter.getRoots();
}
else {
fromRootFilter = roots;
}
Collection<VirtualFile> fromStructureFilter;
if (structureFilter != null) {
Pair<Set<VirtualFile>, MultiMap<VirtualFile, VirtualFile>> rootsAndFiles =
collectRoots(structureFilter.getFiles(), new HashSet<VirtualFile>(roots));
fromStructureFilter = ContainerUtil.union(rootsAndFiles.first, rootsAndFiles.second.keySet());
}
else {
fromStructureFilter = roots;
}
return new HashSet<VirtualFile>(ContainerUtil.intersection(fromRootFilter, fromStructureFilter));
}
示例3: getCommonBranches
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
/**
* Only common hg heavy branches
*/
@NotNull
public static List<String> getCommonBranches(@NotNull Collection<HgRepository> repositories) {
Collection<String> commonBranches = null;
for (HgRepository repository : repositories) {
Collection<String> names = repository.getOpenedBranches();
if (commonBranches == null) {
commonBranches = names;
}
else {
commonBranches = ContainerUtil.intersection(commonBranches, names);
}
}
if (commonBranches != null) {
ArrayList<String> common = new ArrayList<String>(commonBranches);
Collections.sort(common);
return common;
}
else {
return Collections.emptyList();
}
}
示例4: getCommonBookmarks
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static List<String> getCommonBookmarks(@NotNull Collection<HgRepository> repositories) {
Collection<String> commonBookmarkNames = null;
for (HgRepository repository : repositories) {
Collection<HgNameWithHashInfo> bookmarksInfo = repository.getBookmarks();
Collection<String> names = HgUtil.getSortedNamesWithoutHashes(bookmarksInfo);
if (commonBookmarkNames == null) {
commonBookmarkNames = names;
}
else {
commonBookmarkNames = ContainerUtil.intersection(commonBookmarkNames, names);
}
}
if (commonBookmarkNames != null) {
ArrayList<String> common = new ArrayList<String>(commonBookmarkNames);
Collections.sort(common);
return common;
}
else {
return Collections.emptyList();
}
}
示例5: getTrackingBranches
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
/**
* Returns local branches which track the given remote branch. Usually there is 0 or 1 such branches.
*/
@NotNull
public Collection<String> getTrackingBranches(@NotNull String remoteBranch) {
Collection<String> trackingBranches = null;
for (GitRepository repository : myRepositories) {
Collection<String> tb = getTrackingBranches(repository, remoteBranch);
if (trackingBranches == null) {
trackingBranches = tb;
}
else {
trackingBranches = ContainerUtil.intersection(trackingBranches, tb);
}
}
return trackingBranches == null ? Collections.<String>emptyList() : trackingBranches;
}
示例6: getMergedToBranches
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private List<String> getMergedToBranches(String branchName) {
List<String> mergedToBranches = null;
for (GitRepository repository : getRemainingRepositories()) {
List<String> branches = getMergedToBranches(repository, branchName);
if (mergedToBranches == null) {
mergedToBranches = branches;
}
else {
mergedToBranches = new ArrayList<String>(ContainerUtil.intersection(mergedToBranches, branches));
}
}
return mergedToBranches != null ? mergedToBranches : new ArrayList<String>();
}
示例7: getCommonBranches
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public static Collection<String> getCommonBranches(Collection<GitRepository> repositories,
boolean local) {
Collection<String> commonBranches = null;
for (GitRepository repository : repositories) {
GitBranchesCollection branchesCollection = repository.getBranches();
Collection<String> names = local
? convertBranchesToNames(branchesCollection.getLocalBranches())
: getBranchNamesWithoutRemoteHead(branchesCollection.getRemoteBranches());
if (commonBranches == null) {
commonBranches = names;
}
else {
commonBranches = ContainerUtil.intersection(commonBranches, names);
}
}
if (commonBranches != null) {
ArrayList<String> common = new ArrayList<String>(commonBranches);
Collections.sort(common);
return common;
}
else {
return Collections.emptyList();
}
}