Tabnine Logo
List.remove
Code IndexAdd Tabnine to your IDE (free)

How to use
remove
method
in
java.util.List

Best Java code snippets using java.util.List.remove (Showing top 20 results out of 119,835)

Refine searchRefine arrow

  • List.add
  • List.size
  • List.get
  • List.isEmpty
  • Map.get
  • List.contains
origin: square/okhttp

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;
   }
  }
 }
}
origin: square/okhttp

public Builder removeAll(String name) {
 for (int i = 0; i < namesAndValues.size(); i += 2) {
  if (name.equalsIgnoreCase(namesAndValues.get(i))) {
   namesAndValues.remove(i); // name
   namesAndValues.remove(i); // value
   i -= 2;
  }
 }
 return this;
}
origin: google/guava

 <E> E pop(List<E> stack) {
  return stack.remove(stack.size() - 1);
 }
};
origin: Bilibili/DanmakuFlameMaster

private void setDanmakuVisible(boolean visible, int type) {
  if (visible) {
    mFilterTypes.remove(Integer.valueOf(type));
  } else if (!mFilterTypes.contains(Integer.valueOf(type))) {
    mFilterTypes.add(type);
  }
}
origin: skylot/jadx

public void addRecentFile(String filePath) {
  recentFiles.remove(filePath);
  recentFiles.add(0, filePath);
  int count = recentFiles.size();
  if (count > RECENT_FILES_COUNT) {
    recentFiles.subList(RECENT_FILES_COUNT, count).clear();
  }
  partialSync(settings -> settings.recentFiles = recentFiles);
}
origin: ReactiveX/RxJava

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());
origin: square/okhttp

public Builder removePathSegment(int index) {
 encodedPathSegments.remove(index);
 if (encodedPathSegments.isEmpty()) {
  encodedPathSegments.add(""); // Always leave at least one '/'.
 }
 return this;
}
origin: google/ExoPlayer

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();
 }
}
origin: spring-projects/spring-framework

@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);
}
origin: jenkinsci/jenkins

  fragments.add(ef.refresh());
while (!newFinders.isEmpty()) {
  ExtensionFinder f = newFinders.remove(newFinders.size()-1).getInstance();
  if (!actions.contains(a)) actions.add(a);
origin: commonsguy/cw-omnibus

public boolean addOpenEditor(Uri document) {
 List<Uri> current=getOpenEditors();
 if (!current.contains(document)) {
  if (current.size()>9) {
   current.remove(0);
  }
  current.add(document);
  return(saveHistory(current));
 }
 return(true);
}
origin: alibaba/canal

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);
}
origin: apache/kafka

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);
}
origin: google/ExoPlayer

@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();
}
origin: apache/kafka

public void maybeRemoveFromInflightBatches(ProducerBatch batch) {
  List<ProducerBatch> batches = inFlightBatches.get(batch.topicPartition);
  if (batches != null) {
    batches.remove(batch);
    if (batches.isEmpty()) {
      inFlightBatches.remove(batch.topicPartition);
    }
  }
}
origin: apache/incubator-druid

 /**
  * Removes the latest holder, so that {@link #get()} returns the next one.
  */
 void next()
 {
  if (!holders.isEmpty()) {
   holders.remove(holders.size() - 1);
  }
 }
}
origin: stanfordnlp/CoreNLP

@Override
public E next() {
 if (!hasNext()) {
  throw new IllegalArgumentException("Iterator is empty!");
 }
 E next = iters.get(0).next();
 lastIter = iters.get(0);
 while (!iters.isEmpty() && !iters.get(0).hasNext()) {
  iters.remove(0);
 }
 return next;
}
@Override
origin: stanfordnlp/CoreNLP

private void removeBaselineFeature(String featName) {
 if(baselineFeatures.contains(featName)) {
  baselineFeatures.remove(featName);
  Pair<TregexPattern,Function<TregexMatcher,String>> p = annotationPatterns.get(featName);
  activeAnnotations.remove(p);
 }
}
origin: spring-projects/spring-framework

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;
}
origin: google/guava

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));
 }
}
java.utilListremove

Javadoc

Removes the object at the specified location from this List.

Popular methods of List

  • add
  • size
    Returns the number of elements in this List.
  • get
    Returns the element at the specified location in this List.
  • isEmpty
    Returns whether this List contains no elements.
  • addAll
  • toArray
    Returns an array containing all elements contained in this List. If the specified array is large eno
  • contains
    Tests whether this List contains the specified object.
  • iterator
    Returns an iterator on the elements of this List. The elements are iterated in the same order as the
  • clear
  • stream
  • forEach
  • set
    Replaces the element at the specified position in this list with the specified element (optional ope
  • forEach,
  • set,
  • subList,
  • indexOf,
  • equals,
  • hashCode,
  • removeAll,
  • listIterator,
  • sort

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • startActivity (Activity)
  • getApplicationContext (Context)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now