Refine search
private InvalidTagChecker( VisitorState state, ImmutableSet<JavadocTag> validTags, ImmutableSet<String> parameters) { this.state = state; this.validTags = validTags; this.parameters = parameters; this.misplacedCurly = Pattern.compile( String.format( "@(%s)\\{", validTags.stream() .filter(tag -> tag.type() == TagType.INLINE) .map(JavadocTag::name) .collect(joining("|")))); }
/** * Returns the list of registry aliases for the given {@code registry}, including {@code registry} * as the first element. * * @param registry the registry for which the alias group is requested * @return non-empty list of registries where {@code registry} is the first element */ public static List<String> getAliasesGroup(String registry) { for (ImmutableSet<String> aliasGroup : REGISTRY_ALIAS_GROUPS) { if (aliasGroup.contains(registry)) { // Found a group. Move the requested "registry" to the front before returning it. Stream<String> self = Stream.of(registry); Stream<String> withoutSelf = aliasGroup.stream().filter(alias -> !registry.equals(alias)); return Stream.concat(self, withoutSelf).collect(Collectors.toList()); } } return Collections.singletonList(registry); } }
private Set<Symbol> getJoinRequiredSymbols(JoinNode node) { return Streams.concat( node.getCriteria().stream().map(JoinNode.EquiJoinClause::getLeft), node.getCriteria().stream().map(JoinNode.EquiJoinClause::getRight), node.getFilter().map(SymbolsExtractor::extractUnique).orElse(ImmutableSet.of()).stream(), node.getLeftHashSymbol().map(ImmutableSet::of).orElse(ImmutableSet.of()).stream(), node.getRightHashSymbol().map(ImmutableSet::of).orElse(ImmutableSet.of()).stream()) .collect(toImmutableSet()); }
public void finalizeDependencies() { if (dependencies != null && dependencies.size() > 0) { Path robolectricCache = rootProject.file(ROBOLECTRIC_CACHE).toPath(); FileUtil.deleteQuietly(robolectricCache); robolectricCache.toFile().mkdirs(); Map<String, String> targetsNameMap = dependencies .stream() .collect( Collectors.toMap(BuckRuleComposer::external, ExternalDependency::getTargetName)); Rule fileGroup = new SymlinkBuckFile() .targetsNameMap(targetsNameMap) .base("") .name(ROBOLECTRIC_TARGET_NAME); buckFileManager.writeToBuckFile( ImmutableList.of(fileGroup), robolectricCache.resolve(OkBuckGradlePlugin.BUCK).toFile()); } }
/** * Gets checkstyle's modules (directly, not recursively) in the given packages. * @param packages the collection of package names to use * @param loader the class loader used to load Checkstyle package names * @return the set of checkstyle's module classes * @throws IOException if the attempt to read class path resources failed * @see #isCheckstyleModule(Class) */ public static Set<Class<?>> getCheckstyleModules( Collection<String> packages, ClassLoader loader) throws IOException { final ClassPath classPath = ClassPath.from(loader); return packages.stream() .flatMap(pkg -> classPath.getTopLevelClasses(pkg).stream()) .map(ClassPath.ClassInfo::load) .filter(ModuleReflectionUtil::isCheckstyleModule) .collect(Collectors.toSet()); }
/** * @param pred predicate over {@link AccessPath}s * @return NullnessStore containing only AccessPaths that pass the predicate */ public NullnessStore filterAccessPaths(Predicate<AccessPath> pred) { return new NullnessStore( contents .entrySet() .stream() .filter(e -> pred.test(e.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); }
private ContentPackUninstallDetails getUninstallDetails(ContentPackV1 contentPack, ContentPackInstallation installation) { final Entity rootEntity = EntityV1.createRoot(contentPack); final ImmutableMap<String, ValueReference> parameters = installation.parameters(); final ImmutableGraph<Entity> dependencyGraph = buildEntityGraph(rootEntity, contentPack.entities(), parameters); final Traverser<Entity> entityTraverser = Traverser.forGraph(dependencyGraph); final Iterable<Entity> entitiesInOrder = entityTraverser.breadthFirst(rootEntity); final Set<NativeEntityDescriptor> nativeEntityDescriptors = new HashSet<>(); entitiesInOrder.forEach((entity -> { if (entity.equals(rootEntity)) { return; } final Optional<NativeEntityDescriptor> nativeEntityDescriptorOptional = installation.entities().stream() .filter(descriptor -> entity.id().equals(descriptor.contentPackEntityId())) .findFirst(); if (nativeEntityDescriptorOptional.isPresent()) { NativeEntityDescriptor nativeEntityDescriptor = nativeEntityDescriptorOptional.get(); if (contentPackInstallationPersistenceService .countInstallationOfEntityById(nativeEntityDescriptor.id()) <= 1) { nativeEntityDescriptors.add(nativeEntityDescriptor); } } })); return ContentPackUninstallDetails.create(nativeEntityDescriptors); }
private List<IssueDto> loadIssues(SearchResponseData preloadedResponseData, Collector collector, DbSession dbSession) { List<IssueDto> preloadedIssues = preloadedResponseData.getIssues(); Set<String> preloadedIssueKeys = preloadedIssues.stream().map(IssueDto::getKey).collect(MoreCollectors.toSet(preloadedIssues.size())); ImmutableSet<String> issueKeys = ImmutableSet.copyOf(collector.getIssueKeys()); Set<String> issueKeysToLoad = copyOf(difference(issueKeys, preloadedIssueKeys)); if (issueKeysToLoad.isEmpty()) { return issueKeys.stream() .map(new KeyToIssueFunction(preloadedIssues)::apply).filter(Objects::nonNull) .collect(Collectors.toList()); } List<IssueDto> loadedIssues = dbClient.issueDao().selectByKeys(dbSession, issueKeysToLoad); List<IssueDto> unorderedIssues = concat(preloadedIssues.stream(), loadedIssues.stream()) .collect(toList(preloadedIssues.size() + loadedIssues.size())); return issueKeys.stream() .map(new KeyToIssueFunction(unorderedIssues)::apply).filter(Objects::nonNull) .collect(Collectors.toList()); }
public OnHeapPollingCache(Iterable<Map.Entry<K, V>> entries) { if (entries == null) { immutableMap = ImmutableMap.of(); immutableReverseMap = ImmutableMap.of(); } else { ImmutableSet.Builder<V> setOfValuesBuilder = ImmutableSet.builder(); ImmutableMap.Builder<K, V> mapBuilder = ImmutableMap.builder(); for (Map.Entry<K, V> entry : entries) { setOfValuesBuilder.add(entry.getValue()); mapBuilder.put(entry.getKey(), entry.getValue()); } final Set<V> setOfValues = setOfValuesBuilder.build(); immutableMap = mapBuilder.build(); immutableReverseMap = ImmutableMap.copyOf( Maps.asMap( setOfValues, val -> immutableMap .keySet() .stream() .filter(key -> { V retVal = immutableMap.get(key); return retVal != null && retVal.equals(val); }) .collect(Collectors.toList()) ) ); } }
String networkMode = getZaleniumNetwork(zaleniumContainerName); return containerList.stream() .filter(container -> { if (ZALENIUM_RUNNING_LOCALLY) { return container.ports().stream().anyMatch(port -> port.publicPort() == remoteUrl.getPort()); .config() .exposedPorts() .stream() .anyMatch(port -> port.equalsIgnoreCase(String.valueOf(remoteUrl.getPort()))); } catch (DockerException | InterruptedException e) {