private void removeAllCanonicalQueryParameters(String canonicalName) { for (int i = encodedQueryNamesAndValues.size() - 2; i >= 0; i -= 2) { if (canonicalName.equals(encodedQueryNamesAndValues.get(i))) { encodedQueryNamesAndValues.remove(i + 1); encodedQueryNamesAndValues.remove(i); if (encodedQueryNamesAndValues.isEmpty()) { encodedQueryNamesAndValues = null; return; } } } }
List<Integer> list = new VolatileSizeArrayList<Integer>(); assertTrue(list.isEmpty()); assertEquals(0, list.size()); assertFalse(list.contains(1)); assertFalse(list.remove((Integer)1)); assertTrue(list.contains(2)); assertFalse(list.remove((Integer)10)); assertFalse(list.isEmpty()); assertEquals(7, list.size()); assertEquals(7, list.size()); assertEquals(i, list.get(i - 1).intValue()); assertFalse(list.equals(list3)); assertEquals(list.toString(), list3.toString()); list.remove(0); assertEquals(6, list.size()); assertEquals(0, list.size()); assertTrue(list.isEmpty());
private void moveMediaSourceInternal(int currentIndex, int newIndex) { int startIndex = Math.min(currentIndex, newIndex); int endIndex = Math.max(currentIndex, newIndex); int windowOffset = mediaSourceHolders.get(startIndex).firstWindowIndexInChild; int periodOffset = mediaSourceHolders.get(startIndex).firstPeriodIndexInChild; mediaSourceHolders.add(newIndex, mediaSourceHolders.remove(currentIndex)); for (int i = startIndex; i <= endIndex; i++) { MediaSourceHolder holder = mediaSourceHolders.get(i); holder.firstWindowIndexInChild = windowOffset; holder.firstPeriodIndexInChild = periodOffset; windowOffset += holder.timeline.getWindowCount(); periodOffset += holder.timeline.getPeriodCount(); } }
@Override public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) { Assert.notNull(beanPostProcessor, "BeanPostProcessor must not be null"); // Remove from old position, if any this.beanPostProcessors.remove(beanPostProcessor); // Track whether it is instantiation/destruction aware if (beanPostProcessor instanceof InstantiationAwareBeanPostProcessor) { this.hasInstantiationAwareBeanPostProcessors = true; } if (beanPostProcessor instanceof DestructionAwareBeanPostProcessor) { this.hasDestructionAwareBeanPostProcessors = true; } // Add to end of list this.beanPostProcessors.add(beanPostProcessor); }
public synchronized void subscribe(ClientIdentity clientIdentity) throws CanalMetaManagerException { List<ClientIdentity> clientIdentitys = destinations.get(clientIdentity.getDestination()); if (clientIdentitys.contains(clientIdentity)) { clientIdentitys.remove(clientIdentity); } clientIdentitys.add(clientIdentity); }
private void processPartitionMovement(TopicPartition partition, String newConsumer, Map<String, List<TopicPartition>> currentAssignment, TreeSet<String> sortedCurrentSubscriptions, Map<TopicPartition, String> currentPartitionConsumer) { String oldConsumer = currentPartitionConsumer.get(partition); sortedCurrentSubscriptions.remove(oldConsumer); sortedCurrentSubscriptions.remove(newConsumer); partitionMovements.movePartition(partition, oldConsumer, newConsumer); currentAssignment.get(oldConsumer).remove(partition); currentAssignment.get(newConsumer).add(partition); currentPartitionConsumer.put(partition, newConsumer); sortedCurrentSubscriptions.add(newConsumer); sortedCurrentSubscriptions.add(oldConsumer); }
@Override public void releasePeriod(MediaPeriod mediaPeriod) { DeferredMediaPeriod deferredMediaPeriod = (DeferredMediaPeriod) mediaPeriod; List<DeferredMediaPeriod> mediaPeriods = deferredMediaPeriodByAdMediaSource.get(deferredMediaPeriod.mediaSource); if (mediaPeriods != null) { mediaPeriods.remove(deferredMediaPeriod); } deferredMediaPeriod.releasePeriod(); }
private ModelMethod getNextModelMethod(ModelAndViewContainer container) { for (ModelMethod modelMethod : this.modelMethods) { if (modelMethod.checkDependencies(container)) { this.modelMethods.remove(modelMethod); return modelMethod; } } ModelMethod modelMethod = this.modelMethods.get(0); this.modelMethods.remove(modelMethod); return modelMethod; }
public static void assertContainsAllOf(Iterable<?> actual, Object... expected) { List<Object> expectedList = new ArrayList<>(); expectedList.addAll(Arrays.asList(expected)); for (Object o : actual) { expectedList.remove(o); } if (!expectedList.isEmpty()) { Assert.fail("Not true that " + actual + " contains all of " + Arrays.asList(expected)); } }