本文整理汇总了Java中org.gradle.util.CollectionUtils.filter方法的典型用法代码示例。如果您正苦于以下问题:Java CollectionUtils.filter方法的具体用法?Java CollectionUtils.filter怎么用?Java CollectionUtils.filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.util.CollectionUtils
的用法示例。
在下文中一共展示了CollectionUtils.filter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findJvms
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public List<JvmInstallation> findJvms() {
List<JvmInstallation> jvms = new ArrayList<JvmInstallation>();
if (OperatingSystem.current().isLinux()) {
jvms = addJvm(jvms, JavaVersion.VERSION_1_5, "1.5.0", new File("/opt/jdk/sun-jdk-5"), true, JvmInstallation.Arch.i386);
jvms = addJvm(jvms, JavaVersion.VERSION_1_6, "1.6.0", new File("/opt/jdk/sun-jdk-6"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_6, "1.6.0", new File("/opt/jdk/ibm-jdk-6"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_7, "1.7.0", new File("/opt/jdk/oracle-jdk-7"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_8, "1.8.0", new File("/opt/jdk/oracle-jdk-8"), true, JvmInstallation.Arch.x86_64);
jvms = addJvm(jvms, JavaVersion.VERSION_1_9, "1.9.0", new File("/opt/jdk/oracle-jdk-9"), true, JvmInstallation.Arch.x86_64);
}
return CollectionUtils.filter(jvms, new Spec<JvmInstallation>() {
public boolean isSatisfiedBy(JvmInstallation element) {
return element.getJavaHome().isDirectory();
}
});
}
示例2: checkExpiration
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
@Override
public DaemonExpirationResult checkExpiration() {
Spec<DaemonInfo> spec = new Spec<DaemonInfo>() {
@Override
public boolean isSatisfiedBy(DaemonInfo daemonInfo) {
return compatibilitySpec.isSatisfiedBy(daemonInfo.getContext());
}
};
Collection<DaemonInfo> compatibleIdleDaemons = CollectionUtils.filter(daemon.getDaemonRegistry().getIdle(), spec);
if (compatibleIdleDaemons.size() > 1) {
return new DaemonExpirationResult(DaemonExpirationStatus.GRACEFUL_EXPIRE, EXPIRATION_REASON);
} else {
return DaemonExpirationResult.NOT_TRIGGERED;
}
}
示例3: getModelledInstructions
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
private Map<String, List<String>> getModelledInstructions() {
Map<String, List<String>> modelledInstructions = new HashMap<String, List<String>>();
modelledInstructions.put(Analyzer.BUNDLE_SYMBOLICNAME, createListFromPropertyString(symbolicName));
modelledInstructions.put(Analyzer.BUNDLE_NAME, createListFromPropertyString(name));
modelledInstructions.put(Analyzer.BUNDLE_VERSION, createListFromPropertyString(version));
modelledInstructions.put(Analyzer.BUNDLE_DESCRIPTION, createListFromPropertyString(description));
modelledInstructions.put(Analyzer.BUNDLE_LICENSE, createListFromPropertyString(description));
modelledInstructions.put(Analyzer.BUNDLE_VENDOR, createListFromPropertyString(vendor));
modelledInstructions.put(Analyzer.BUNDLE_DOCURL, createListFromPropertyString(docURL));
return CollectionUtils.filter(modelledInstructions, new Spec<Map.Entry<String, List<String>>>() {
public boolean isSatisfiedBy(Map.Entry<String, List<String>> element) {
return element.getValue() != null;
}
});
}
示例4: getExternalSourceFolders
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
/**
* see {@link #getRegularSourceFolders}
*
* @return source folders that live outside of the project
*/
public List<SourceFolder> getExternalSourceFolders(Iterable<SourceSet> sourceSets, Function<File, String> provideRelativePath) {
List<SourceFolder> sourceFolders = projectRelativeFolders(sourceSets, provideRelativePath);
List<SourceFolder> externalSourceFolders = CollectionUtils.filter(sourceFolders, new Spec<SourceFolder>() {
@Override
public boolean isSatisfiedBy(SourceFolder element) {
return element.getPath().contains("..");
}
});
List<SourceFolder> regularSourceFolders = getRegularSourceFolders(sourceSets, provideRelativePath);
List<String> sources = Lists.newArrayList(Lists.transform(regularSourceFolders, new Function<SourceFolder, String>() {
@Override
public String apply(SourceFolder sourceFolder) {
return sourceFolder.getName();
}
}));
return trimAndDedup(externalSourceFolders, sources);
}
示例5: getIdeRepoFileDependencies
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
/**
* Gets IDE repository file dependencies.
*
* @param configuration Configuration
* @return IDE repository file dependencies
*/
public List<IdeExtendedRepoFileDependency> getIdeRepoFileDependencies(Configuration configuration) {
ResolutionResult result = getIncomingResolutionResult(configuration);
final Set<ResolvedComponentResult> resolvedRepoFileComponents = CollectionUtils.filter(result.getAllComponents(), new Spec<ResolvedComponentResult>() {
@Override
public boolean isSatisfiedBy(ResolvedComponentResult element) {
return element.getId() instanceof ModuleComponentIdentifier;
}
});
Set<ModuleVersionIdentifier> mappedResolvedDependencies = mapResolvedDependencies(resolvedRepoFileComponents);
Set<ResolvedArtifact> artifacts = getExternalArtifacts(configuration);
List<IdeExtendedRepoFileDependency> externalDependencies = new ArrayList<IdeExtendedRepoFileDependency>();
for (ResolvedArtifact artifact : artifacts) {
if (mappedResolvedDependencies.contains(artifact.getModuleVersion().getId())) {
IdeExtendedRepoFileDependency ideRepoFileDependency = new IdeExtendedRepoFileDependency(artifact.getFile());
ideRepoFileDependency.setId(artifact.getModuleVersion().getId());
externalDependencies.add(ideRepoFileDependency);
}
}
return externalDependencies;
}
示例6: filter
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public FileCollection filter(final Spec<? super File> filterSpec) {
return new AbstractFileCollection() {
@Override
public String getDisplayName() {
return AbstractFileCollection.this.getDisplayName();
}
@Override
public TaskDependency getBuildDependencies() {
return AbstractFileCollection.this.getBuildDependencies();
}
public Set<File> getFiles() {
return CollectionUtils.filter(AbstractFileCollection.this, new LinkedHashSet<File>(), filterSpec);
}
};
}
示例7: getUnclassifiedArtifactsWithExtension
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
private Set<MavenArtifact> getUnclassifiedArtifactsWithExtension() {
return CollectionUtils.filter(mavenArtifacts, new Spec<MavenArtifact>() {
public boolean isSatisfiedBy(MavenArtifact mavenArtifact) {
return hasNoClassifier(mavenArtifact) && hasExtension(mavenArtifact);
}
});
}
示例8: getSupported
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public List<GradleDistribution> getSupported() {
final GradleVersion firstSupported = GradleVersion.version("1.0");
return CollectionUtils.filter(getAll(), new Spec<GradleDistribution>() {
@Override
public boolean isSatisfiedBy(GradleDistribution element) {
return element.getVersion().compareTo(firstSupported) >= 0;
}
});
}
示例9: getImmutableDaemonProperties
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public Map<String, Object> getImmutableDaemonProperties() {
return CollectionUtils.filter(immutableSystemProperties, new Spec<Map.Entry<String, Object>>() {
@Override
public boolean isSatisfiedBy(Map.Entry<String, Object> element) {
return IMMUTABLE_DAEMON_SYSTEM_PROPERTIES.contains(element.getKey());
}
});
}
示例10: oldStopEvents
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public static List<DaemonStopEvent> oldStopEvents(final List<DaemonStopEvent> stopEvents) {
return CollectionUtils.filter(stopEvents, new Spec<DaemonStopEvent>() {
@Override
public boolean isSatisfiedBy(DaemonStopEvent event) {
return !event.occurredInLastHours(RECENTLY);
}
});
}
示例11: getPendingResolutions
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
public List<NativeBinaryRequirementResolveResult> getPendingResolutions() {
return CollectionUtils.filter(resolutions, new Spec<NativeBinaryRequirementResolveResult>() {
public boolean isSatisfiedBy(NativeBinaryRequirementResolveResult element) {
return !element.isComplete();
}
});
}
示例12: getRegularSourceFolders
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
/**
* paths that navigate higher than project dir are not allowed in eclipse .classpath
* regardless if they are absolute or relative
*
* @return source folders that live inside the project
*/
public List<SourceFolder> getRegularSourceFolders(Iterable<SourceSet> sourceSets, Function<File, String> provideRelativePath) {
List<SourceFolder> sourceFolders = projectRelativeFolders(sourceSets, provideRelativePath);
return CollectionUtils.filter(sourceFolders, new Spec<SourceFolder>() {
@Override
public boolean isSatisfiedBy(SourceFolder element) {
return !element.getPath().contains("..");
}
});
}
示例13: getIdeProjectDependencies
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
/**
* Gets IDE project dependencies.
*
* @param configuration Configuration
* @param project Project
* @return IDE project dependencies
*/
public List<IdeProjectDependency> getIdeProjectDependencies(Configuration configuration, Project project) {
ResolutionResult result = getIncomingResolutionResult(configuration);
final Set<ResolvedComponentResult> projectComponents = CollectionUtils.filter(result.getAllComponents(), new Spec<ResolvedComponentResult>() {
@Override
public boolean isSatisfiedBy(ResolvedComponentResult element) {
return element.getId() instanceof ProjectComponentIdentifier;
}
});
List<IdeProjectDependency> ideProjectDependencies = new ArrayList<IdeProjectDependency>();
ProjectComponentIdentifier thisProjectId = DefaultProjectComponentIdentifier.newProjectId(project);
for (ResolvedComponentResult projectComponent : projectComponents) {
ProjectComponentIdentifier projectId = (ProjectComponentIdentifier) projectComponent.getId();
if (thisProjectId.equals(projectId)) {
continue;
}
if (!projectId.getBuild().isCurrentBuild()) {
// Don't have access to the ProjectInstance: we can't use it to determine the name.
ideProjectDependencies.add(new IdeProjectDependency(projectId));
} else {
Project resolvedProject = project.project(projectId.getProjectPath());
ideProjectDependencies.add(new IdeProjectDependency(projectId, resolvedProject.getName()));
}
}
return ideProjectDependencies;
}
示例14: getQuotedIncludes
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
@Override
public List<Include> getQuotedIncludes() {
return CollectionUtils.filter(allIncludes, new Spec<Include>() {
@Override
public boolean isSatisfiedBy(Include element) {
return element.getType() == IncludeType.QUOTED;
}
});
}
示例15: getSystemIncludes
import org.gradle.util.CollectionUtils; //导入方法依赖的package包/类
@Override
public List<Include> getSystemIncludes() {
return CollectionUtils.filter(allIncludes, new Spec<Include>() {
@Override
public boolean isSatisfiedBy(Include element) {
return element.getType() == IncludeType.SYSTEM;
}
});
}