Refine search
private static Map<Direction, RelationshipType[]> toTypeMap( Map<Direction, Collection<RelationshipType>> tempMap ) { // Remove OUT/IN where there is a BOTH Collection<RelationshipType> both = tempMap.get( Direction.BOTH ); tempMap.get( Direction.OUTGOING ).removeAll( both ); tempMap.get( Direction.INCOMING ).removeAll( both ); // Convert into a final map Map<Direction, RelationshipType[]> map = new EnumMap<>( Direction.class ); for ( Map.Entry<Direction, Collection<RelationshipType>> entry : tempMap.entrySet() ) { if ( !entry.getValue().isEmpty() ) { map.put( entry.getKey(), entry.getValue().toArray( new RelationshipType[entry.getValue().size()] ) ); } } return map; }
/** * Get slave data source names. * * @return available slave data source names */ @Override public Collection<String> getSlaveDataSourceNames() { if (disabledDataSourceNames.isEmpty()) { return super.getSlaveDataSourceNames(); } Collection<String> result = new LinkedList<>(super.getSlaveDataSourceNames()); result.removeAll(disabledDataSourceNames); return result; }
private void onPermissionsChecked(Collection<String> permissions) { if (pendingPermissions.isEmpty()) { return; } synchronized (pendingPermissionsMutex) { pendingPermissions.removeAll(permissions); if (pendingPermissions.isEmpty()) { activity.finish(); activity = null; isRequestingPermission.set(false); rationaleAccepted.set(false); isShowingNativeDialog.set(false); MultiplePermissionsListener currentListener = listener; listener = EMPTY_LISTENER; currentListener.onPermissionsChecked(multiplePermissionsReport); } } }
private void processAlias(MapWork work, Path path, Collection<String> aliasesAffected, Set<String> aliases) { // the aliases that are allowed to map to a null scan. Collection<String> allowed = aliasesAffected.stream() .filter(a -> aliases.contains(a)).collect(Collectors.toList()); if (!allowed.isEmpty()) { PartitionDesc partDesc = work.getPathToPartitionInfo().get(path).clone(); PartitionDesc newPartition = changePartitionToMetadataOnly(partDesc, path); // Prefix partition with something to avoid it being a hidden file. Path fakePath = new Path(NullScanFileSystem.getBase() + newPartition.getTableName() + "/part" + encode(newPartition.getPartSpec())); StringInternUtils.internUriStringsInPath(fakePath); work.addPathToPartitionInfo(fakePath, newPartition); work.addPathToAlias(fakePath, new ArrayList<>(allowed)); aliasesAffected.removeAll(allowed); if (aliasesAffected.isEmpty()) { work.removePathToAlias(path); work.removePathToPartitionInfo(path); } } }
executorsNotScheduled.removeAll(scheduledTasks); if (!executorsNotScheduled.isEmpty()) { LOG.warn("Scheduling {} left over task (most likely sys tasks)", executorsNotScheduled); executorsNotScheduled.removeAll(scheduledTasks); executorsNotScheduled.removeAll(scheduledTasks); if (executorsNotScheduled.size() > 0) { LOG.error("Not all executors successfully scheduled: {}", executorsNotScheduled);
/** * Perform scan. * * @param scanCtx Scan context. */ private void scan(UriDeploymentScannerContext scanCtx) { Collection<String> foundFiles = U.newHashSet(tstampCache.size()); long start = U.currentTimeMillis(); processHttp(foundFiles, scanCtx); if (scanCtx.getLogger().isDebugEnabled()) scanCtx.getLogger().debug("HTTP scanner time in ms: " + (U.currentTimeMillis() - start)); if (!scanCtx.isFirstScan()) { Collection<String> deletedFiles = new HashSet<>(tstampCache.keySet()); deletedFiles.removeAll(foundFiles); if (!deletedFiles.isEmpty()) { List<String> uris = new ArrayList<>(); for (String file : deletedFiles) uris.add(getFileUri(fileName(file), scanCtx)); tstampCache.keySet().removeAll(deletedFiles); scanCtx.getListener().onDeletedFiles(uris); } } }
/** * This test performs complex set of operations on store from multiple threads. * * @throws Exception If failed. */ private void testPutGetRemove(boolean writeCoalescing) throws Exception { initStore(2, writeCoalescing); Set<Integer> exp; try { exp = runPutGetRemoveMultithreaded(10, 10); } finally { shutdownStore(); } Map<Integer, String> map = delegate.getMap(); Collection<Integer> extra = new HashSet<>(map.keySet()); extra.removeAll(exp); assertTrue("The underlying store contains extra keys: " + extra, extra.isEmpty()); Collection<Integer> missing = new HashSet<>(exp); missing.removeAll(map.keySet()); assertTrue("Missing keys in the underlying store: " + missing, missing.isEmpty()); for (Integer key : exp) assertEquals("Invalid value for key " + key, "val" + key, map.get(key)); }
while ( !toProcessEntities.isEmpty() ) { Set<MetaEntity> processedEntities = new HashSet<MetaEntity>(); int toProcessCountBeforeLoop = toProcessEntities.size(); processedEntities.add( entity ); toProcessEntities.removeAll( processedEntities ); if ( toProcessEntities.size() >= toProcessCountBeforeLoop ) { context.logMessage(
if (!unmatchedAggregations.isEmpty()) { removeUnmatchedGroupingAgg(unmatchedAggregations); tryDimensionAsMeasures(unmatchedAggregations, result, if (!unmatchedAggregations.isEmpty()) { Iterator<FunctionDesc> itr = unmatchedAggregations.iterator(); while (itr.hasNext()) { if (!unmatchedDimensions.isEmpty()) { unmatchedDimensions.removeAll(dimCols);
private void doTestVariantsInner(@NotNull CompletionType type, int count, CheckType checkType, String... variants) { myFixture.complete(type, count); List<String> stringList = myFixture.getLookupElementStrings(); assertNotNull("\nPossibly the single variant has been completed.\nFile after:\n" + myFixture.getFile().getText(), stringList); Collection<String> varList = ContainerUtil.newArrayList(variants); if (checkType == CheckType.ORDERED_EQUALS) { UsefulTestCase.assertOrderedEquals(stringList, variants); } else if (checkType == CheckType.EQUALS) { UsefulTestCase.assertSameElements(stringList, variants); } else if (checkType == CheckType.INCLUDES) { varList.removeAll(stringList); assertTrue("Missing variants: " + varList, varList.isEmpty()); } else if (checkType == CheckType.EXCLUDES) { varList.retainAll(stringList); assertTrue("Unexpected variants: " + varList, varList.isEmpty()); } }
expOnly.removeAll(cacheKeys); cacheOnly.removeAll(expVals.keySet()); if (!expOnly.isEmpty()) log.error("Cache does not contain expected keys: " + expOnly); if (!cacheOnly.isEmpty()) log.error("Cache does contain unexpected keys: " + cacheOnly); expOnly.removeAll(dhtCacheKeys); cacheOnly.removeAll(expVals.keySet()); if (!expOnly.isEmpty()) log.error("DHT cache does not contain expected keys: " + expOnly);