if(pCoeff.size()>thisCoeff.size()){
difference=pCoeff.size()-thisCoeff.size();
for(int i=thisCoeff.size(); i<thisCoeff.size()+difference;i++){
thisCoeff.add(i, new Double(0.0)); //this line throws errors
}
}
I've isolated this portion of my program as being the cause of memory leak, is it...
Hello again, I've looked around but I can't seem to find an API call that does the following: I need to merge all ArrayLists in an ArrayList to form one ArrayList with all the elements from all the sub-ArrayLists, if that makes sense.
Here's an example:
{"It's", "a", {"small", "world, "after"}, {"all"}} becomes {"It's", "a", "small", "...
Developing Java, you have always learned that its best to create an ArrayList by using the List interface as the type for the variable the list is stored in. Like this
List<String> myList = new ArrayList<String>();
However, by looking at a lot of the android examples that is included in the bundle, they have created the list by using ...
So, now I've figured out how to make multiple of the same object correctly, I need to know how to make an array of them, changing depending on how many are needed, because it is pretty much an object, that stores 3 numbers. How can I Create an arraylist that is of different objects, because I'm going to have the numbers inside them diffe...
Say I had a an enum called Planets that contained VENUS, EARTH, and MARS. I will have a lot of array lists that will hold at most one of each type. I want to keep each array list sorted at all times in order from VENUS, EARTH, and MARS.
Would I need to use a comparator for this? Is there a way to keep them sorted automatically after an ...
I'm a relatively new Java programmer and I'm having difficuly removing more than one element from an ArrayList. Ideally I'd like to do something like this:
ArrayList ar1 = new ArrayList();
ar1.add(...)
ar1.add(...)
ar1.add(...)
ar1.add(...)
for (int i = 0; i < 2; i++){
ar1.remove(i);
}
I think iterator might help, but I can't f...
dear all
I have an array of strings.
Some of The strings are similar (for example, person is similar to twolegperson, animal is similar to animalgold).
I want to find the strings that are repeated more than 1 times (here person,animal).
Thank you very much
faty
...
I have
ArrayList<String> ids = ArrayList<String>();
What would be the cleanest way to make it Parceleable? Apparently String itself is not parcelable, so Parcel.writeList(ids) is not working.
I was thinking to either parcelize ArrayList<Uri> or put array contents into a Bundle.
...
ArrayList list_of_employees = new ArrayList();
@Action
public void reportAllEmployeesClicked(java.awt.event.ActionEvent evt)
{
this.outputText.setText("");
int i=0;
//JOptionPane.showMessageDialog(null,"test Employee list print");
ListIterator list_ir = list_of_employees.listIterator(); //list_of_employees is of
...
Hi, I have the following code:
static ArrayList<PreparedStatement> alPrepStmts = new ArrayList<PreparedStatement>();
static PreparedStatement m_stmtOne;
static PreparedStatement m_stmtTwo;
static PreparedStatement m_stmtThree;
...
static PreparedStatement m_stmtOneHundred;
private static void init() {
alPrepStmts.add(m_stmtOne);
...
Hi
I want to pass an Arraylist from one activity to another.
I use putStringArrayListExtra(), but there shows an error :
"The method putStringArrayListExtra(String,ArrayList is undefined for the type bundle."
Is there any other method available for passing ArrayList?
String test[]=new String[3];
ArrayList<String[]> al=new ArrayList...
Hi I want to pass an Arraylist from one activity to another. I use putStringArrayListExtra(), but there shows an error : "The method putStringArrayListExtra(String,ArrayList is undefined for the type bundle." Is there any other method available for passing ArrayList?
String test[]=new String[3];
ArrayList al=new ArrayList();
int x,...
I am trying to make a really simple Tic-Tac-Toe game. I have stored values of "X" and "O" in a 0-8 ArrayList (3x3 square, essentially). I can do the following for each instance of a winning situation:
if ((newBoard().get(0)).equals("X") &&
(newBoard().get(1)).equals("X") &&
(newBoard().get(2)).equals("X")){
System.out.println("...
I am the beginnings of writing a tic-tac-toe game. I just ran it and got the following stack trace:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:571)
at java.util.ArrayList.get(ArrayList.java:349)
at TicTacToe.isMarked(TicTacToe.java:23)
at TicTac...
ArrayList userItem = new ArrayList();
userItem.add(item.getUserId()+"|"+item.getEmail()+"|"+item.getImgInstance());
ArrayList userItem = onlineUsers.get(item.getImgInstance());
I want to know what the last line will do to the list will it append the value of onlineUsers.get(item.getImgInstance()) in the previous string or somethign e...
Can I add a group of ArrayList into a single ArrayList?
The ArrayList groups are of different sizes. Then How can I recognize each ArrayList?
...
Hi,
I'm doing web service to import data using the API but I cannot import data because there is an error in soap "Fault code: soap:Server
Fault string: Server was unable to process request. ---> get out!"
What does it mean?
Any help is appreciated.
Thanks in advance! :)
...
Ok so I know that Set, List and Map are interfaces but what makes the first line of code any better than the second line?
List myArr = new ArrayList();
ArrayList myArr = new ArrayList();
Thanks.
...
Possible Duplicate:
Java null pointer exceptions - don't understand why
MOVIE.JAVA
package javaPractical.week3;
import javax.swing.*;
public class Movie {
// private attributes
private String title;
private String movieURL;
private String year;
private String genre;
private String actor;
// constructor
Movie(String t, Stri...