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

How to use
clear
method
in
java.util.List

Best Java code snippets using java.util.List.clear (Showing top 20 results out of 109,359)

Refine searchRefine arrow

  • List.add
  • List.size
  • List.get
  • List.addAll
  • List.isEmpty
origin: spring-projects/spring-framework

/**
 * Configure "streaming" media types for which flushing should be performed
 * automatically vs at the end of the stream.
 * <p>By default this is set to {@link MediaType#APPLICATION_STREAM_JSON}.
 * @param mediaTypes one or more media types to add to the list
 * @see HttpMessageEncoder#getStreamingMediaTypes()
 */
public void setStreamingMediaTypes(List<MediaType> mediaTypes) {
  this.streamingMediaTypes.clear();
  this.streamingMediaTypes.addAll(mediaTypes);
}
origin: spring-projects/spring-framework

/**
 * Set the locale of the request, overriding any previous locales.
 * @param locale the locale, or {@code null} to reset it
 * @see #locale(Locale...)
 */
public MockHttpServletRequestBuilder locale(@Nullable Locale locale) {
  this.locales.clear();
  if (locale != null) {
    this.locales.add(locale);
  }
  return this;
}
origin: libgdx/libgdx

private void takeSnapshot () {
  mainDependenciesSnapshot.clear();
  for (int i = 0; i < mainDependencies.size(); i++) {
    mainDependenciesSnapshot.add(mainDependencies.get(i));
  }
}
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: spring-projects/spring-framework

/**
 * Remove all registered transformers, in inverse order of registration.
 */
public void removeTransformers() {
  synchronized (this.transformers) {
    if (this.instrumentation != null && !this.transformers.isEmpty()) {
      for (int i = this.transformers.size() - 1; i >= 0; i--) {
        this.instrumentation.removeTransformer(this.transformers.get(i));
      }
      this.transformers.clear();
    }
  }
}
origin: apache/incubator-druid

@Override
public void writeRowEnd()
{
 // Avoid writing blank lines, users may confuse them with the trailer.
 final boolean quoteEverything = currentLine.size() == 1 && currentLine.get(0).isEmpty();
 writer.writeNext(currentLine.toArray(new String[0]), quoteEverything);
 currentLine.clear();
}
origin: apache/storm

private void ack(List<Tuple> tuples) {
  if (!tuples.isEmpty()) {
    LOG.debug("Acking {} tuples", tuples.size());
    for (Tuple tuple : tuples) {
      collector.delegate.ack(tuple);
    }
    tuples.clear();
  }
}
origin: thinkaurelius/titan

@Override
protected void action() {
  MessageEnvelope msg;
  //Opportunistically drain the queue for up to the batch-send-size number of messages before evaluating condition
  while (toSend.size()<sendBatchSize && (msg=outgoingMsg.poll())!=null) {
    toSend.add(msg);
  }
  //Evaluate send condition: 1) Is the oldest message waiting longer than the delay? or 2) Do we have enough messages to send?
  if (!toSend.isEmpty() && (maxSendDelay.compareTo(timeSinceFirstMsg()) <= 0 || toSend.size() >= sendBatchSize)) {
    try {
      sendMessages(toSend);
    } finally {
      toSend.clear();
    }
  }
}
origin: twosigma/beakerx

public void jobStart(int jobId, List<String> executorIds) {
 activeJobId = jobId;
 if (!jobs.contains(jobId)) {
  jobs.add(jobId);
  stagesPerJob.put(jobId, new ArrayList<Integer>());
 }
 if (!executorIds.isEmpty()) {
  this.executorIds.clear();
  this.executorIds.addAll(executorIds);
 }
}
origin: JetBrains/ideavim

public void reset() {
 myRows.clear();
 for (Map.Entry<KeyStroke, ShortcutOwner> entry : VimPlugin.getKey().getShortcutConflicts().entrySet()) {
  final KeyStroke keyStroke = entry.getKey();
  final List<AnAction> actions = VimPlugin.getKey().getKeymapConflicts(keyStroke);
  if (!actions.isEmpty()) {
   myRows.add(new Row(keyStroke, actions.get(0), entry.getValue()));
  }
 }
 Collections.sort(myRows);
}
origin: apache/kafka

/**
 * Drain all the calls from newCalls into pendingCalls.
 *
 * This function holds the lock for the minimum amount of time, to avoid blocking
 * users of AdminClient who will also take the lock to add new calls.
 */
private synchronized void drainNewCalls() {
  if (!newCalls.isEmpty()) {
    pendingCalls.addAll(newCalls);
    newCalls.clear();
  }
}
origin: skylot/jadx

private static void insertAtStart(BlockNode block, List<InsnNode> insns) {
  List<InsnNode> blockInsns = block.getInstructions();
  List<InsnNode> newInsnList = new ArrayList<>(insns.size() + blockInsns.size());
  newInsnList.addAll(insns);
  newInsnList.addAll(blockInsns);
  blockInsns.clear();
  blockInsns.addAll(newInsnList);
}
origin: bumptech/glide

public synchronized void setBucketPriorityList(@NonNull List<String> buckets) {
 List<String> previousBuckets = new ArrayList<>(bucketPriorityList);
 bucketPriorityList.clear();
 bucketPriorityList.addAll(buckets);
 for (String previousBucket : previousBuckets) {
  if (!buckets.contains(previousBucket)) {
   // Keep any buckets from the previous list that aren't included here, but but them at the
   // end.
   bucketPriorityList.add(previousBucket);
  }
 }
}
origin: spring-projects/spring-framework

private void updateFilters() {
  if (this.filters.isEmpty()) {
    return;
  }
  List<WebFilter> filtersToUse = this.filters.stream()
      .peek(filter -> {
        if (filter instanceof ForwardedHeaderTransformer && this.forwardedHeaderTransformer == null) {
          this.forwardedHeaderTransformer = (ForwardedHeaderTransformer) filter;
        }
      })
      .filter(filter -> !(filter instanceof ForwardedHeaderTransformer))
      .collect(Collectors.toList());
  this.filters.clear();
  this.filters.addAll(filtersToUse);
}
origin: skylot/jadx

  public boolean test(List<String> l1, List<String> l2) {
    if (l2.size() > 0) {
      l1.clear();
    }
    return l1.size() == 0;
  }
}
origin: commons-io/commons-io

/**
 * @see java.io.ByteArrayOutputStream#reset()
 */
public synchronized void reset() {
  count = 0;
  filledBufferSum = 0;
  currentBufferIndex = 0;
  if (reuseBuffers) {
    currentBuffer = buffers.get(currentBufferIndex);
  } else {
    //Throw away old buffers
    currentBuffer = null;
    final int size = buffers.get(0).length;
    buffers.clear();
    needNewBuffer(size);
    reuseBuffers = true;
  }
}
origin: spring-projects/spring-framework

@Override
public ResponseSpec onStatus(Predicate<HttpStatus> statusPredicate,
    Function<ClientResponse, Mono<? extends Throwable>> exceptionFunction) {
  if (this.statusHandlers.size() == 1 && this.statusHandlers.get(0) == DEFAULT_STATUS_HANDLER) {
    this.statusHandlers.clear();
  }
  this.statusHandlers.add(new StatusHandler(statusPredicate,
      (clientResponse, request) -> exceptionFunction.apply(clientResponse)));
  return this;
}
origin: google/ExoPlayer

public void rollUp() {
 rolledUpCaptions.add(buildSpannableString());
 captionStringBuilder.setLength(0);
 cueStyles.clear();
 int numRows = Math.min(captionRowCount, row);
 while (rolledUpCaptions.size() >= numRows) {
  rolledUpCaptions.remove(0);
 }
}
origin: org.springframework/spring-context

/**
 * Remove all registered transformers, in inverse order of registration.
 */
public void removeTransformers() {
  synchronized (this.transformers) {
    if (this.instrumentation != null && !this.transformers.isEmpty()) {
      for (int i = this.transformers.size() - 1; i >= 0; i--) {
        this.instrumentation.removeTransformer(this.transformers.get(i));
      }
      this.transformers.clear();
    }
  }
}
origin: google/j2objc

public void setMethodForStubbing(InvocationMatcher invocation) {
  invocationForStubbing = invocation;
  assert hasAnswersForStubbing();
  for (int i = 0; i < answersForStubbing.size(); i++) {
    addAnswer(answersForStubbing.get(i), i != 0);
  }
  answersForStubbing.clear();
}
java.utilListclear

Javadoc

Removes all elements from this List, leaving it empty.

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.
  • remove
    Removes the first occurrence of the specified object from this List.
  • iterator
    Returns an iterator on the elements of this List. The elements are iterated in the same order as the
  • 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.
  • Top Vim plugins
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