I am creating an application which retrieve from an external party application an arraylist of Integer values. It seems that some of the elements in this retrieved list are empty or null. When I retrieve the size of the list for example:
System.out.println("The number of elements is : "+ elements_list.size());
it just throws an null p...
I'm having issues formatting an input String into an ArrayList. I commented out some of the things I've tried. Initially I tried to put the input into a string then add to arrayList.
The input is one long string:
(A,Name1,200), (A,Name1,200), (R,Name1,200), (A,Name2,900), (A,Name2,500), (A,Name3,800), (A,Name4,150), (A,Name5,850), (A...
I want a list of things, and then I want to test the list to see if an item exists:
Here is my example snippet:
String[] handToolArray = {"pliers", "screwdriver", "tape measure"};
List<String> handToolList = new ArrayList<String>( Arrays.asList(handToolArray));
if (handToolList.contains("pliers")){
System.out.prin...
How much data can be added in java.util.List in Java at the maximum
Is there any default size an array list?
...
I've got the unenviable task of cleaning up a rather messy VB.Net client. The general plan is to move all calculations to WebServices, and I can see exactly how to do this, but it involves passing a large number of different variables to the WebServices.
I chose to use an ArrayList as I've worked with them heavily in Java, and have had ...
I have an ArrayList of instances of a class I created, each of which contains a single field with a String. I have implemented Comparable in the class I created. How do I sort the Array List?
...
I have to iterate through an arraylist in this manner.
ArrayList<Integer> li = new ArrayList<Integer>();
li.add(20);
li.add(30);
li.add(40);
li.add(50);
li.add(70);
for (int i = 0; i < li.size() - 1; i++)
System.out.println(li.get(i) + " " + li.get(i + 1));
Output:
20 30
30 40
40 50
50 70
How to do the same using an iterator?
...
I need to retrieve values from dictionary which stores a ArrayList which in turn has an ArrayList This second ArrayList has int array stored . Now how can I retrieve those integer values. `
Dictionary<int, ArrayList> obj = new Dictionary<int, ArrayList>();
ArrayList objList1 = new ArrayList();
ArrayList objLi...
We are experiencing weird bug at production environment we cannot debug nor inject logging code. I am trying to figure this up but following stack trace confuse me.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.ArrayList.Add(Object value)
at ...
According to the MSDN Add method...
If fooService.getFoos() returns List<Foo>.
then you can write this:
List<Foo> fooList = fooService.getFoos();
or this:
List<Foo> fooList = new ArrayList(fooService.getFoos());
Is there any significant difference in the resulting fooList between these two approaches?
...
Alright so I'm trying to get this class work:
public boolean hasPoint(Point p){
for (int i=0; i<this.points.size(); i++){
// Right here
if(points[i].equals(p)){
return true;
}
}
return false;
}
However on line 3 I seem to be calling points as an array, but it's actually an arrayl...
public boolean addPoint(Point p){
points.add(p);
return points.add(p);
extremes();
}
Alright so when I run this code the main class calls addPoint and passes it a Point, however when it gets to the line "points.add(p);" it gives me a "java.lang.NullPointerException" error. FYI: "points" is an arrayList.
Also on a sid...
Hi there
I have page gets given an ArrayList<Document> where each document has a property called type.
I don't know the number of unique types or documents.
I want to sort this ArrayList into a HashMap<type, document[]> but am having some trouble getting my head around it.
Some pseudo-code would like like
for (int i = 0; i < documen...
Is it possible to create a multidimensional arraylist in C#?
StartDate Qty size
9/1/2010 10 15
9/1/2009 12 17
9/1/2008 11 19
StartDate , Qty and size are the 3 arraylists. I need to have them in a single array list. I would also need to sort this arraylist by startdate. Let me know if this possible? Is there a...
Hello,I am trying to create a program that is just like a Process Table. I have to implement a class PCB (Process Control Block) with several fields such as:process name (a string)
process priority (an integer)
register set values (an object of a class Register Set containing the following fields: XAR, XDI, XDO, PC.
Then my program ne...
ive got an array that has three values; crime, drama, thriller. Im trying to loop through each value and save it to the database. How do i extract a name from the array and save it in the database.
...
I am experimenting a little bit with gamestudio.
I am making now a shooter game.
I have an array with the pointer's to the enemies. I want. to when an enemy is killed. remove him from the list. And I also want to be able to create new enemies.
Gamestudio uses a scripting language named lite-C. It has the same syntax as C and on the webs...
Hi,
in c# if i have an arraylist populated like (ID, ITEMQUANTITY), and i would like to compare them by ID, how would i do that?
I mean, i need to customize it so that i can compare it by the first value only, so if i want to insert another item i can check if the id is already in the list....
I know how to do it by looping through all ...
If I set up an iterator for myList:
Iterator iter = myList.iterator();
while(iter.hasNext())
{
MyObj myObj = (MyObj)iter.next();
doPrint(myObj.toString());
}
And I call it a second time:
while(iter.hasNext())
{
MyObj myObj = (MyObj)iter.next();
doPrint(myObj.toString());
}
Will it go back to the start of the collect...
List<String> listA = new ArrayList<String>();
listA.add("a");
listA.add("b");
listA.add("c");
listA.add("d");
List<String> listB = new ArrayList<String>();
listB.add("c");
listB.add("d");
listB.add("e");
listB.add("f");
ListB contains two elements that are also present in ListA ("c" and "d").
Is there a clean way to make sure that ...