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

How to use
replaceAll
method
in
java.util.List

Best Java code snippets using java.util.List.replaceAll (Showing top 20 results out of 576)

origin: google/guava

@Override
public void replaceAll(UnaryOperator<E> operator) {
 synchronized (mutex) {
  delegate().replaceAll(operator);
 }
}
origin: prestodb/presto

@Override
public void replaceAll(UnaryOperator<E> operator) {
 synchronized (mutex) {
  delegate().replaceAll(operator);
 }
}
origin: wildfly/wildfly

@Override
public void replaceAll(UnaryOperator<E> operator) {
 synchronized (mutex) {
  delegate().replaceAll(operator);
 }
}
origin: konsoletyper/teavm

@Override
public void visit(InvokeDynamicInstruction insn) {
  Optional.ofNullable(insn.getInstance()).map(mapper).ifPresent(insn::setInstance);
  insn.getArguments().replaceAll(mapper);
}
origin: apache/geode

 /**
  * @param buffer use the buffer to find the completion candidates
  *
  *        Note the cursor may not be the size the buffer
  */
 private List<Completion> getCandidates(String buffer) {
  List<Completion> candidates = new ArrayList<>();
  // always pass the buffer length as the cursor position for simplicity purpose
  super.completeAdvanced(buffer, buffer.length(), candidates);
  // trimming the candidates
  candidates.replaceAll(completion -> new Completion(completion.getValue().trim()));
  return candidates;
 }
}
origin: google/guava

@ListFeature.Require(SUPPORTS_SET)
public void testReplaceAll_changesSome() {
 getList().replaceAll(e -> e.equals(samples.e0()) ? samples.e3() : e);
 E[] expected = createSamplesArray();
 for (int i = 0; i < expected.length; i++) {
  if (expected[i].equals(samples.e0())) {
   expected[i] = samples.e3();
  }
 }
 expectContents(expected);
}
origin: google/guava

@ListFeature.Require(SUPPORTS_SET)
public void testReplaceAll() {
 getList().replaceAll(e -> samples.e3());
 expectContents(Collections.nCopies(getNumElements(), samples.e3()));
}
origin: google/guava

 @CollectionSize.Require(absent = ZERO)
 @ListFeature.Require(absent = SUPPORTS_SET)
 public void testReplaceAll_unsupported() {
  try {
   getList().replaceAll(e -> e);
   fail("replaceAll() should throw UnsupportedOperationException");
  } catch (UnsupportedOperationException expected) {
  }
  expectUnchanged();
 }
}
origin: jankotek/mapdb

public void testReplaceAllIsNotStructuralModification() {
  Collection c = impl.emptyCollection();
  if (!(c instanceof List))
    return;
  List list = (List) c;
  ThreadLocalRandom rnd = ThreadLocalRandom.current();
  for (int n = rnd.nextInt(2, 10); n--> 0; )
    list.add(impl.makeElement(rnd.nextInt()));
  ArrayList copy = new ArrayList(list);
  int size = list.size(), half = size / 2;
  Iterator it = list.iterator();
  for (int i = 0; i < half; i++)
    assertEquals(it.next(), copy.get(i));
  list.replaceAll(n -> n);
  // ConcurrentModificationException must not be thrown here.
  for (int i = half; i < size; i++)
    assertEquals(it.next(), copy.get(i));
}
origin: apache/geode

potentials.replaceAll(
  completion -> new Completion(completion.getValue().substring(candidateBeginAt)));
potentials.replaceAll(completion -> new Completion("=" + completion.getValue()));
origin: debezium/debezium

@Override
public TableEditor renameColumn(String existingName, String newName) {
  final Column existing = columnWithName(existingName);
  if (existing == null) throw new IllegalArgumentException("No column with name '" + existingName + "'");
  Column newColumn = existing.edit().name(newName).create();
  // Determine the primary key names ...
  List<String> newPkNames = null;
  if ( !hasUniqueValues() && primaryKeyColumnNames().contains(existing.name())) {
    newPkNames = new ArrayList<>(primaryKeyColumnNames());
    newPkNames.replaceAll(name->existing.name().equals(name) ? newName : name);
  }
  // Add the new column, move it before the existing column, and remove the old column ...
  addColumn(newColumn);
  reorderColumn(newColumn.name(), existing.name());
  removeColumn(existing.name());
  if (newPkNames != null) {
    setPrimaryKeyNames(newPkNames);
  }
  return this;
}
origin: stackoverflow.com

 List<Integer> l = Arrays.asList(2,3,6,1,9);
l.replaceAll(p->p*2);
origin: ebean-orm/ebean

@Override
public void replaceAll(UnaryOperator<E> operator) {
 checkCopyOnWrite();
 list.replaceAll(operator);
}
origin: diffplug/spotless

  /** If the user hasn't specified the files yet, we'll assume he/she means all of the java files. */
  @Override
  protected void setupTask(SpotlessTask task) {
    if (target == null) {
      JavaPluginConvention javaPlugin = getProject().getConvention().findPlugin(JavaPluginConvention.class);
      if (javaPlugin == null) {
        throw new GradleException("You must apply the java plugin before the spotless plugin if you are using the java extension.");
      }
      FileCollection union = getProject().files();
      for (SourceSet sourceSet : javaPlugin.getSourceSets()) {
        union = union.plus(sourceSet.getAllJava());
      }
      target = union;
    }

    steps.replaceAll(step -> {
      if (LicenseHeaderStep.name().equals(step.getName())) {
        return step.filterByFile(LicenseHeaderStep.unsupportedJvmFilesFilter());
      } else {
        return step;
      }
    });
    super.setupTask(task);
  }
}
origin: diffplug/spotless

steps.replaceAll(step -> {
  if (LicenseHeaderStep.name().equals(step.getName())) {
    return step.filterByFile(LicenseHeaderStep.unsupportedJvmFilesFilter());
origin: stackoverflow.com

 String[] planets = new String[] { "Mercury", "Venus", "Earth", "Mars", 
    "Jupiter", "Saturn", "Uranus", "Neptune" };
Arrays.asList(planets).replaceAll(s -> new StringBuilder(s).reverse().toString());
System.out.println(Arrays.toString(planets));
// [yrucreM, suneV, htraE, sraM, retipuJ, nrutaS, sunarU, enutpeN]
origin: OpenGamma/Strata

@Override
public MutablePointSensitivities withCurrency(Currency currency) {
 sensitivities.replaceAll(ps -> ps.withCurrency(currency));
 return this;
}
origin: org.weakref/jmxutils

@Override
public void replaceAll(UnaryOperator<E> operator) {
 synchronized (mutex) {
  delegate().replaceAll(operator);
 }
}
origin: com.google.guava/guava-testlib

@ListFeature.Require(SUPPORTS_SET)
public void testReplaceAll() {
 getList().replaceAll(e -> samples.e3());
 expectContents(Collections.nCopies(getNumElements(), samples.e3()));
}
origin: com.google.guava/guava-testlib

 @CollectionSize.Require(absent = ZERO)
 @ListFeature.Require(absent = SUPPORTS_SET)
 public void testReplaceAll_unsupported() {
  try {
   getList().replaceAll(e -> e);
   fail("replaceAll() should throw UnsupportedOperationException");
  } catch (UnsupportedOperationException expected) {
  }
  expectUnchanged();
 }
}
java.utilListreplaceAll

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
  • clear
  • stream
  • forEach
  • stream,
  • 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.
  • CodeWhisperer 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