how to replace the values

Ads

 
 

Share on Google+Share on Google+

nani
how to replace the values
1 Answer(s)      8 years ago
Posted in : Development process
Ads
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

Ads









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:  General Format array array
Advertisements
Replace
Replace   Hi, 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 2)b.txt A B C Now i want output is like below
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
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 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
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
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
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 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 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
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 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
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 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 ".... Make Selection: Select which part you want to replace by the Polygonal Lasso
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
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
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 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 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 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 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
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
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 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
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
how to display the database values in pdf format
how to display the database values in pdf format   in struts how to display the values in pdf format when clicking a button in jsp page   jsp code using itext api: <%@page import="java.io.*"%> <%@page import
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

Ads

 
Advertisement null

Ads