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

How to use
replaceAll
method
in
java.util.Collections

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

origin: stackoverflow.com

List<String> list = Arrays.asList(
   "one", "two", "three", null, "two", null, "five"
 );
 System.out.println(list);
 // [one, two, three, null, two, null, five]
 Collections.replaceAll(list, "two", "one");
 System.out.println(list);
 // [one, one, three, null, one, null, five]
 Collections.replaceAll(list, "five", null);
 System.out.println(list);
 // [one, one, three, null, one, null, null]
 Collections.replaceAll(list, null, "none");
 System.out.println(list);
 // [one, one, three, none, one, none, none]
origin: com.liferay.faces/com.liferay.faces.bridge.ext

@Override
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
  Collections.replaceAll(childNodes, oldChild, newChild);
  return oldChild;
}
origin: backport-util-concurrent/backport-util-concurrent

public static boolean replaceAll(List list, Object oldVal, Object newVal) {
  return java.util.Collections.replaceAll(list, oldVal, newVal);
}
origin: org.codehaus.swizzle/swizzle-jirareport

public boolean replaceAll(List list, Object o, Object o1) {
  return Collections.replaceAll(list, o, o1);
}
origin: stackoverflow.com

 public void replaceVideo(Vector<Library> videos, Library current, Library newCopy)
{
 Collections.replaceAll(videos, current, newCopy);
}
origin: stackoverflow.com

 List<String> list = pmMap.get(value1);
if(list != null){
  Collections.replaceAll(list, value1, value2);
}
origin: edu.emory.mathcs.backport/com.springsource.edu.emory.mathcs.backport

public static boolean replaceAll(List list, Object oldVal, Object newVal) {
  return java.util.Collections.replaceAll(list, oldVal, newVal);
}
origin: spotify/styx

 static List<String> argsReplace(List<String> template, String parameter) {
  List<String> result = new ArrayList<>(template);

  Collections.replaceAll(result, "{}", parameter);
  return result;
 }
}
origin: apache/cloudstack

@Override
@ActionEvent(eventType = EventTypes.EVENT_FIREWALL_EGRESS_OPEN, eventDescription = "creating egress firewall rule for network", create = true)
public FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException {
  Account caller = CallContext.current().getCallingAccount();
  Network network = _networkDao.findById(rule.getNetworkId());
  if (network.getGuestType() == Network.GuestType.Shared) {
    throw new InvalidParameterValueException("Egress firewall rules are not supported for " + network.getGuestType() + "  networks");
  }
  List<String> sourceCidrs = rule.getSourceCidrList();
  if (sourceCidrs != null && !sourceCidrs.isEmpty())
  Collections.replaceAll(sourceCidrs, "0.0.0.0/0", network.getCidr());
  return createFirewallRule(null, caller, rule.getXid(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getProtocol(), sourceCidrs, rule.getDestinationCidrList(),
      rule.getIcmpCode(), rule.getIcmpType(), null, rule.getType(), rule.getNetworkId(), rule.getTrafficType(), rule.isDisplay());
}
origin: stackoverflow.com

 List<String> list = Arrays.asList(new String[] {"a","b"});      
System.out.println(list);
Collections.replaceAll(list, "a", "!!!!!");
System.out.println(list);
origin: stackoverflow.com

 String[] values= {null,"p", ";","z",null, "OR","y"};        
List<String> list=new ArrayList<String>(Arrays.asList(values));
Collections.replaceAll(list, null, "newVal");
values = list.toArray(new String[list.size()]);
System.out.println(Arrays.toString(values));
origin: stackoverflow.com

 List<String> lines = new ArrayList<String>();
lines.add("This");
lines.add("this");
lines.add("THIS");
lines.add("this won't work.");
Collections.replaceAll(lines, "this", "****");
System.out.println(lines);
origin: stackoverflow.com

// let's say:
 // whole = "The city of San Francisco is truly beautiful!",
 // token = "San Francisco"
 public static String[] excludeString(String whole, String token) {
   // replaces token string "San Francisco" with "SanFrancisco"
   whole = whole.replaceAll(token, token.replaceAll("\\s+", ""));
   // splits whole string using space as delimiter, place tokens in a string array
   String[] strarr = whole.split("\\s+");
   // brings "SanFrancisco" back to "San Francisco" in strarr
   Collections.replaceAll(Arrays.asList(strarr), token.replaceAll("\\s+", ""), token);
   // returns the array of strings
   return strarr;
 }
origin: org.talend.components/components-salesforce-runtime

public BulkResultSet getResultSet(InputStream input) throws IOException {
  CsvReader reader = new CsvReader(new InputStreamReader(input), getDelimitedChar(columnDelimiter));
  List<String> baseFileHeader = null;
  if (reader.readRecord()) {
    baseFileHeader = Arrays.asList(reader.getValues());
    Collections.replaceAll(baseFileHeader, "sf__Id", "salesforce_id");
    Collections.replaceAll(baseFileHeader, "sf__Created", "salesforce_created");
  }
  return new BulkResultSet(reader, baseFileHeader);
}
origin: Talend/components

public BulkResultSet getResultSet(InputStream input) throws IOException {
  CsvReader reader = new CsvReader(new InputStreamReader(input), getDelimitedChar(columnDelimiter));
  List<String> baseFileHeader = null;
  if (reader.readRecord()) {
    baseFileHeader = Arrays.asList(reader.getValues());
    Collections.replaceAll(baseFileHeader, "sf__Id", "salesforce_id");
    Collections.replaceAll(baseFileHeader, "sf__Created", "salesforce_created");
  }
  return new BulkResultSet(reader, baseFileHeader);
}
origin: Qihoo360/Quicksql

public static void collect(RexNode node, RexNode seek, Logic logic,
  List<Logic> logicList) {
 node.accept(new LogicVisitor(seek, logicList), logic);
 // Convert FALSE (which can only exist within LogicVisitor) to
 // UNKNOWN_AS_TRUE.
 Collections.replaceAll(logicList, Logic.FALSE, Logic.UNKNOWN_AS_TRUE);
}
origin: org.apache.calcite/calcite-core

public static void collect(RexNode node, RexNode seek, Logic logic,
  List<Logic> logicList) {
 node.accept(new LogicVisitor(seek, logicList), logic);
 // Convert FALSE (which can only exist within LogicVisitor) to
 // UNKNOWN_AS_TRUE.
 Collections.replaceAll(logicList, Logic.FALSE, Logic.UNKNOWN_AS_TRUE);
}
origin: com.github.sommeri/less4j

public void replaceSelector(Selector oldSelector, Selector newSelector) {
 oldSelector.setParent(null);
 newSelector.setParent(this);
 
 Collections.replaceAll(this.selectors, oldSelector, newSelector);
}
origin: AskNowQA/AutoSPARQL

public void replaceReferent(String ref1, String ref2) {
  Collections.replaceAll(m_Arguments,new DiscourseReferent(ref1),new DiscourseReferent(ref2));
}
origin: locationtech/jts

 public static Geometry replace(Geometry parent, Geometry original, Geometry replacement)
 {
  List elem = extractElements(parent, false);
  Collections.replaceAll(elem, original, replacement);
  return parent.getFactory().buildGeometry(elem);
 }
}
java.utilCollectionsreplaceAll

Javadoc

Replaces all occurrences of Object obj in list with newObj. If the obj is null, then all occurrences of null are replaced with newObj.

Popular methods of Collections

  • emptyList
    Returns the empty list (immutable). This list is serializable.This example illustrates the type-safe
  • sort
  • singletonList
    Returns an immutable list containing only the specified object. The returned list is serializable.
  • unmodifiableList
    Returns an unmodifiable view of the specified list. This method allows modules to provide users with
  • emptyMap
    Returns the empty map (immutable). This map is serializable.This example illustrates the type-safe w
  • emptySet
    Returns the empty set (immutable). This set is serializable. Unlike the like-named field, this metho
  • unmodifiableMap
    Returns an unmodifiable view of the specified map. This method allows modules to provide users with
  • singleton
    Returns an immutable set containing only the specified object. The returned set is serializable.
  • unmodifiableSet
    Returns an unmodifiable view of the specified set. This method allows modules to provide users with
  • singletonMap
    Returns an immutable map, mapping only the specified key to the specified value. The returned map is
  • addAll
    Adds all of the specified elements to the specified collection. Elements to be added may be specifie
  • reverse
    Reverses the order of the elements in the specified list. This method runs in linear time.
  • addAll,
  • reverse,
  • unmodifiableCollection,
  • shuffle,
  • enumeration,
  • list,
  • synchronizedMap,
  • synchronizedList,
  • reverseOrder,
  • emptyIterator

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • 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