@Override public void addSummarizers(String tableName, SummarizerConfiguration... newConfigs) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { HashSet<SummarizerConfiguration> currentConfigs = new HashSet<>( SummarizerConfiguration.fromTableProperties(getProperties(tableName))); HashSet<SummarizerConfiguration> newConfigSet = new HashSet<>(Arrays.asList(newConfigs)); newConfigSet.removeIf(currentConfigs::contains); Set<String> newIds = newConfigSet.stream().map(SummarizerConfiguration::getPropertyId) .collect(toSet()); for (SummarizerConfiguration csc : currentConfigs) { if (newIds.contains(csc.getPropertyId())) { throw new IllegalArgumentException("Summarizer property id is in use by " + csc); } } Set<Entry<String,String>> es = SummarizerConfiguration.toTableProperties(newConfigSet) .entrySet(); for (Entry<String,String> entry : es) { setProperty(tableName, entry.getKey(), entry.getValue()); } }
@Override public final boolean removeIf(final Predicate<? super E> filter) { final boolean removed = super.removeIf(filter); modified |= removed; return removed; }
public void add(Method m) { if ((m.getModifiers() & Modifier.ABSTRACT) != 0) return; // Remove any concrete implementations that come from superclasses of the class that owns this new method // (this new class shadows them). contributors.removeIf(m2 -> m2.getDeclaringClass().isAssignableFrom(m.getDeclaringClass())); // Conversely, if this new implementation is shadowed by any existing implementations, we'll drop it instead if (contributors.stream().anyMatch(m2 -> m.getDeclaringClass().isAssignableFrom(m2.getDeclaringClass()))) { return; } contributors.add(m); }
private static Method[] initMethods() { HashSet<Method> aux = new HashSet<Method>(Arrays.asList(RequestTargetTester.class.getDeclaredMethods())); aux.remove(getMethodHelper("addListener", AjaxRequestTarget.IListener.class)); aux.remove(getMethodHelper("respond", IRequestCycle.class)); aux.remove(getMethodHelper("detach", IRequestCycle.class)); aux.removeIf(m -> m.isSynthetic()); return aux.toArray(new Method[aux.size()]); }
@Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { Sets.newHashSet(restrictions).removeIf(r -> REP_NODE_PATH.equals(r.getDefinition().getName())); base.writeRestrictions(oakPath, aceTree, restrictions); }
@Override public void writeRestrictions(String oakPath, Tree aceTree, Set<Restriction> restrictions) throws RepositoryException { Sets.newHashSet(restrictions).removeIf(r -> REP_NODE_PATH.equals(r.getDefinition().getName())); base.writeRestrictions(oakPath, aceTree, restrictions); }
/** * Initialize the handler, setup the authentication entry attributes. */ public void initialize() { /* * Use a set to ensure we ignore duplicates. */ val attributes = new HashSet<String>(); LOGGER.debug("Initializing LDAP attribute configuration..."); if (StringUtils.isNotBlank(this.principalIdAttribute)) { LOGGER.debug("Configured to retrieve principal id attribute [{}]", this.principalIdAttribute); attributes.add(this.principalIdAttribute); } if (this.principalAttributeMap != null && !this.principalAttributeMap.isEmpty()) { val attrs = this.principalAttributeMap.keySet(); attributes.addAll(attrs); LOGGER.debug("Configured to retrieve principal attribute collection of [{}]", attrs); } if (authenticator.getReturnAttributes() != null) { val authenticatorAttributes = CollectionUtils.wrapList(authenticator.getReturnAttributes()); if (!authenticatorAttributes.isEmpty()) { LOGGER.debug("Filtering authentication entry attributes [{}] based on authenticator attributes [{}]", authenticatedEntryAttributes, authenticatorAttributes); attributes.removeIf(authenticatorAttributes::contains); } } this.authenticatedEntryAttributes = attributes.toArray(ArrayUtils.EMPTY_STRING_ARRAY); LOGGER.debug("LDAP authentication entry attributes for the authentication request are [{}]", (Object[]) this.authenticatedEntryAttributes); } }
private void findTargettedModules(char[] prefix, HashSet<String> skipSet) { HashSet<String> probableModules = new HashSet<>(); ModuleSourcePathManager mManager = JavaModelManager.getModulePathManager(); JavaElementRequestor javaElementRequestor = new JavaElementRequestor(); try { mManager.seekModule(this.completionToken, true, javaElementRequestor); IModuleDescription[] modules = javaElementRequestor.getModules(); for (IModuleDescription module : modules) { String name = module.getElementName(); if (name == null || name.equals("")) //$NON-NLS-1$ continue; probableModules.add(name); } } catch (JavaModelException e) { // TODO ignore for now } probableModules.addAll(getAllJarModuleNames(this.javaProject)); if (prefix != CharOperation.ALL_PREFIX && prefix != null && prefix.length > 0) { probableModules.removeIf(e -> isFailedMatch(prefix, e.toCharArray())); } for (String s : probableModules) { if (!skipSet.contains(s)) this.acceptModule(s.toCharArray()); } } private void findTargettedModules(CompletionOnModuleReference moduleReference, HashSet<String> skipSet) {
public int getIndex(Graph<GUINode,GUILink> graph, GUILink e) { final GUINode u = e.getOriginNode(); final GUINode v = e.getDestinationNode(); final HashSet<GUILink> commonEdgeSet = new HashSet<>(graph.getInEdges(v)); commonEdgeSet.retainAll(graph.getOutEdges(u)); commonEdgeSet.removeIf(ee->!ee.isShownSeparated()); int count=0; for(GUILink other : commonEdgeSet) if (other == e) return count; else count ++; throw new RuntimeException(); } });
pureSubscribers.removeIf((s) -> { return s.getDispatcher() != null; });
pureSubscribers.removeIf((s) -> { return s.getDispatcher() != null; });
@SubscribeEvent public static void worldTick(TickEvent.WorldTickEvent event) { if (event.phase == TickEvent.Phase.START) reversals.removeIf((reversal) -> { if (reversal.world.get() == event.world) { if (reversal.nemez.hasNext()) { reversal.nemez.applySnapshot(event.world); if (reversal.pos != null && reversal.world.get().getTotalWorldTime() % PacketNemezReversal.SYNC_AMOUNT == 0) PacketHandler.NETWORK.sendToAllAround(new PacketNemezReversal(reversal.nemez), new NetworkRegistry.TargetPoint(reversal.world.get().provider.getDimension(), reversal.pos.getX() + 0.5, reversal.pos.getY() + 0.5, reversal.pos.getZ() + 0.5, 96)); } else { for (Entity entity : reversal.nemez.getTrackedEntities(event.world)) entity.setNoGravity(false); return true; } } return reversal.world.get() == null; }); }
public void doQueueCheck() { log().d("doQueueCheck"); lastQueueCheck = System.currentTimeMillis(); synchronized (running) { synchronized (jobs) { jobs.removeIf(j -> { return j.isCanceled(); }); jobs.forEach(j -> { if (!queue.contains(j) && !running.contains(j)) { try { log().w("reschedule lost job",j.getName()); j.setNextExecutionTime(SchedulerJob.CALCULATE_NEXT); j.doSchedule(this); } catch (Throwable t) { log().w("reschedule failed",j,t); } } }); } } }