how to replace the values

how to replace the values

View Answers

November 20, 2008 at 3:54 AM

Hi friend,


Code to solve the problem :

import java.util.*;
class ArrayList2
{
public static void main(String[] args)
{
ArrayList al = new ArrayList();
al.add("or");
al.add("c1");
al.add("or");
al.add("c2");
al.add("c3");
al.add("or");
al.add("c4");
System.out.println(al);

String temp = "";

for(int i=0;i<al.size();i++)
{

for(int j=i;j<al.size();j++)
{
if(al.get(i).equals("or"))
{
temp = al.get(i).toString();
al.set(i,al.get(j));
al.set(j,temp);
}

}
}
System.out.println(al);

}
}


Thanks









Related Tutorials/Questions & Answers:
how to replace the values - Development process
how to replace the values  i have arraylist containing "or","c1","or","c2","c3","or",c4" i want the output as "c1","c2","c3","c4","or","or"  Hi friend, Code to solve the problem : import java.util.*; class
PHP Array Replace
PHP Array Replace Sometimes we have to replace array values with given values, PHP provides array_replace() function to replace the values. array_replace... description of array_replace() is: ADS_TO_REPLACE_1 General Format
Advertisements
Replace
Replace   Hi, I have two text files in two diff locatons.The text file like below using java program 1)a.txt (adsbygoogle = window.adsbygoogle || []).push({}); 1 abc bangalore 2 def adfsdf 3
how to set the values in jsp
how to set the values in jsp  how to set the values text boxs in jsp frm dbase via servlet
how to find a dynamic string in a string & how to replace tgat wth with another string - JSP-Servlet
how to find a dynamic string in a string & how to replace tgat wth with another string  Dear sir, i have a ArrayList in that i have stored a values from a excel sheet specified column values and i have one string
ereg_replace() and eregi_replace().
ereg_replace() and eregi_replace().  What is the difference between eregreplace() and eregireplace()?   Hi friends, ereg_replace() is case sensitive like "Bharat"cannot be treated as "bharat"and eregi_replace
PHP Array Replace Recursive
_replace_recursive() replaces the values of first array with the same values from... array, value of the second array will replace the values of first array. If a key...PHP Array Replace Recursive: PHP provides array_replace_recursive() function
how to insert a summary values in grid
how to insert a summary values in grid  how to insert a summary value in grid
How can I get query string values in JavaScript?
How can I get query string values in JavaScript?  How can I get query string values in JavaScript?   To get a query string value, you can...) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex
MySql find and replace string
MySql find and replace string  How to find and replace string or special characters in MySql & PHP?   Find and Replace String PHP $result = preg_replace('/\band\b/i', 'foo', $subject
How to get a values - JSP-Servlet
How to get a values  Dear sir, I have one input text field and one submit button .Within one file how to get a values within a same jsp. Thanks and Regards Harini Veerapur.  Hi Friend, Try the following
ModuleNotFoundError: No module named 'replace'
'replace' How to remove the ModuleNotFoundError: No module named 'replace...ModuleNotFoundError: No module named 'replace'  Hi, My Python... to install padas library. You can install replace python with following command
How to replace a head into another head
How to replace a head into another head. Get ready to learn a simple... face also. Here, I am going to replace a "Cow" head by a "... image.ADS_TO_REPLACE_1 Make Selection: Select which part you want to replace
how to read values from java in xml?
how to read values from java in xml?  how to read values from java in xml
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to show database values into graph using jsp?
How to show database values into graph using jsp?  How to show database values into graph using jsp
How to get a values - JSP-Servlet
getting a null value aprt from a attachmented file,so how to get a other values...How to get a values  Dear sir, I have a one form with a multipart/form-data as follows To From Subject
How to replace all occurrences of a string in JavaScript?
: 3. Regular expression case in-sensitive replace example Now we will see how... in JavaScript Today we are going to learn different ways to replace string in JavaScript. There are many ways to replace all occurrences of a string in JavaScript
How to replace all occurrences of a string in JavaScript?
: 3. Regular expression case in-sensitive replace example Now we will see how... in JavaScript Today we are going to learn different ways to replace string in JavaScript. There are many ways to replace all occurrences of a string in JavaScript
How to replace all occurrences of a string in JavaScript?
in-sensitive replace example Now we will see how to do case in-sensitive replace... in JavaScript Today we are going to learn different ways to replace string in JavaScript. There are many ways to replace all occurrences of a string in JavaScript
How to get the request scope values? - Struts
How to get the request scope values?  Get value in Struts
how to insert values from jsp into ms access
how to insert values from jsp into ms access   how to insert values using jsp into ms access database
python replace newline with space
python replace newline with space  Hi, I want to replace newline character \n With space in python. How to replace newline with space in python? Thanks   Hi, Its easy in python. You can use the replace method
python replace newline with space
python replace newline with space  Hi, I want to replace newline character \n With space in python. How to replace newline with space in python? Thanks   Hi, Its easy in python. You can use the replace method
How to pass multiple values from a servlet to JSP?
How to pass multiple values from a servlet to JSP?  hi, I want to pass multiple values form a servlet to JSP. Hw do i do that? I am able to send one...) values
how to validate all form field values at once.
how to validate all form field values at once.  how to validate all form field values at once. condition:no form field shold contain sometext("--select
Replace JSF Standard Error Message
Replace JSF Standard Error Message  How can we replace the JSF Standard Error Message
dynamically how to change attiribute values in xml
dynamically how to change attiribute values in xml   Hi, I am facing the problem to update the Attribute values in XML file.dynamically how to change attribute values in XML . for example below is my XML structure. text
how to store a dynamic values - JSP-Servlet
how to store a dynamic values  Dear sir, i have a ArrayList in that i have stored a values from a excel sheet specified column values and i... and bonus is ~5 . Thanks Hr in another arraylist i have a values ~2,~3
Replace TEXT
Replace TEXT   I have two text files in two diff locatons.The text file like below using java program 1)a.txt 1 abc bangalore 2 def adfsdf 3 ghij asdfdsad (adsbygoogle = window.adsbygoogle
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
How to carry multiple values from a Servlet to a JSP?
How to carry multiple values from a Servlet to a JSP?  By using...). ----response.sendRedirect("index.jsp?uname="+username);---- But I want multiple values needs to be carried from my servlet to a JSP. How do I do
how char values are converted to their 16-bit representation in jvm?
how char values are converted to their 16-bit representation in jvm?  can anyone explain the conversion of character 'c' to its 16-bit representation in jvm
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file
how to retreive values from MS Access Database based on the values entered in textbox values in jsp file  Hi am new to java. i need to create a dynamic web application. Am using eclipse IDE and Apache tomcat server. i need
How to access session values through Ajax?
How to access session values through Ajax?  Suppose in a servlet a variable userName is kept in session. How can I access this variable from JSP through AJAX? Is it possible
What is the difference between ereg_replace() and eregi_replace()?
What is the difference between ereg_replace() and eregi_replace()?  What is the difference between eregreplace() and eregireplace
replace character in php
replace character in php  PHP script that replace character
How to values from xml using java?
How to values from xml using java?  Hi All, I want to read value from following < Line> xml using java.. In < Line>,data is in format of key and value pair.. i want to read only values..could u plz help me
find and replace in java
find and replace in java  Need 'find and replace' function in Java to find special keyword in XMl such as @,#,!,%..and replace with their corresponding entities
How to create bar chart using database values
How to create bar chart using database values  How to create bar chart using database values i.e excellent,good,average fields using jsp?It is like opinion poll.I want to show how many votes are came for excellent,good,average
how to get a values from processRecord - JSP-Servlet
how to get a values from processRecord  dear sir, i have a problem in getting a values from java to jsp.Here jsp is used to read a excel sheet that intern call a java program so i want a column values i.e a column contains
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....  Hello Sir, I have a method in which i am getting getting wrong... and values like 59,142 etc here i am getting wrong output for the same
ModuleNotFoundError: No module named 'face_replace'
'face_replace' How to remove the ModuleNotFoundError: No module named 'face_replace' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'face_replace'  Hi, My Python
ModuleNotFoundError: No module named 'mass-replace'
'mass-replace' How to remove the ModuleNotFoundError: No module named 'mass-replace' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'mass-replace'  Hi, My Python
ModuleNotFoundError: No module named 'replace_me'
'replace_me' How to remove the ModuleNotFoundError: No module named 'replace_me' error? Thanks   Hi, In your python environment you...ModuleNotFoundError: No module named 'replace_me'  Hi, My Python
ModuleNotFoundError: No module named 'search-replace'
named 'search-replace' How to remove the ModuleNotFoundError: No module named 'search-replace' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'search-replace'  Hi, My
ModuleNotFoundError: No module named 'django-replace'
named 'django-replace' How to remove the ModuleNotFoundError: No module named 'django-replace' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'django-replace'  Hi, My
ModuleNotFoundError: No module named 'docx_replace'
'docx_replace' How to remove the ModuleNotFoundError: No module named 'docx_replace' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'docx_replace'  Hi, My Python
ModuleNotFoundError: No module named 'env_replace'
'env_replace' How to remove the ModuleNotFoundError: No module named 'env_replace' error? Thanks   Hi, In your python environment...ModuleNotFoundError: No module named 'env_replace'  Hi, My Python
ModuleNotFoundError: No module named 'mass-replace'
'mass-replace' How to remove the ModuleNotFoundError: No module named 'mass-replace' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'mass-replace'  Hi, My Python

Ads