arraylist

Sending an ArrayList as a parameter in GWT-RPC

Hi, I tried sending an ArrayList to an RPC service in GWT but keeps on failing. Here is my code fragment greetingService.addNewQuestion(questionnaireKey, questionText, qcList, new AsyncCallback<Boolean>(){ @Override public void onFailure(Throwable caught) { Window.alert("Something went wrong!\n"+caught.getMessage())...

Proper use of Arraylist and Java Generics vs Vectors

I have been using vectors in the past and am very familiar with them. I have heard that ArrayLists are faster and more flexible. I am new to using ArrayLists and Java Generics. I am currently using them as follows and receiving a warning about parametrization (Which I thought I did by declaring them <String>. ArrayList<String> arrayList...

Growth Policy of ArrayList in Java 6SE

I was wondering if anyone knows the growth policy of ArrayList in Java 1.6? The java doc says The details of the growth policy are not specified beyond the fact that adding an element has constant amortized time cost. But I just wonder the details because I know the size I'm targeting to start but I want to make sure I'm making th...

Searching data in a array(list)

Hello everyone, I have a ArrayList containing Attributes class Attribute{ private int id; public string getID(){ return this.id; } private string value; public string getValue(){ return this.value; } //... more properties here... } Well I filled the ArrayList with like hundreds of those attributes. And I want ...

how to convert arraylist to integer array in c#

This is my code con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/techsoft /PP1.accdb;Persist Security Info=False"); con.Open(); cm = new OleDbCommand("select aa from ab", con); OleDbDataReader qq; qq = cm.ExecuteReader(); ArrayList ss = new ArrayList(); ...

Using ArrayList or HashMap

Hi I got a question on whether to use an ArrayList or HashMap. I am trying to build a Paint program. Each drawn object will be assigned a unique object ID. If I want a fast retrieval speed when I click on an object, should I be using an arraylist or hashmap? In general hashmap has O(1) while arraylist has O(n) retrieval speed. Howeve...

Different implementations of ArrayList

We're getting this error java.lang.NullPointerException at java.util.ArrayList.<init>(Unknown Source) at de.mystuff.ExtendedArrayList.<init>(ExtendedArrayList.java:38) where ExtendedArrayList:38 is new ArrayList(new ArrayCollection<E>(data)); In short: the ArrayList constructor sometimes seems to choke on our home grown Col...

How to read from set of arrays line by line in Java?

Hello, My code is as follows: private static ArrayList<String[]> file; ... void method() { file = new ArrayList<String[]>(); ... String[] s = str.split(";"); file.add(s); } In the above, str is a long String that is seperated by semicolons. My problem is that I want to go through each array in the ArrayList and get one ele...

my Java class addUserToTheList() doesn't work

I have the following two classes: import java.io.*; import java.util.*; public class User { public static String nickname; public static String ipAddress; public static ArrayList<String> listOfFiles; public static File sharedFolder; public static String fileLocation; public User(String nickname, String ipAddre...

ASP.NET Arraylist <myobj>

hello, can i use my own class in asp.net for Array list? kind of: Dim list1 As myobj= New ArrayList ...

List or ArrayList?(lots of items)

which one is more memory efficient? which one works faster with 1000000 items? is there anything better? ...

sort arraylist in ascending order

hi, i have an arraylist of objects, each containing a year/month/day/hour property. what i'm ultimately trying to do, is create a new multidimensional array that contains a group of every object by incrementing hour. so for instance, an example of the final array i'd want is: array: [0] [0] 01:04:00, 4-10-09 [...

C# => JAVA: Filling a static ArrayList on declaration. Possible?

In my C# project I have a static List that gets filled immediately when declared. private static List<String> inputs = new List<String>() { "Foo", "Bar", "Foo2", "Bar2"}; How would I do this in Java using the ArrayList? I need to be able to access the values without creating a instance of the class. Is it possible? ...

.net does ArrayList.Clear free up memory?

I have a heavily populated arraylist, which I want to clear and reuse. If I clear it will it free up that previously used memory? I should also mention that the arraylist is a private read only field of a class that still has lots of active work to do after I use the arraylist first time round. So I can't wait for garbage collection aft...

What is the usage of binding a datagridview to an arraylist full of for example some employee objects in c#?

hi I have 2 questions: 1- We all know that can create an array list full of some employee objects and bind a datagridview to it. but is that way have some advantages to other ways? 2- using the way above, how can we get the employee object info when a user clicks on a row of the datagridview? thank you ...

Adding ArrayList elements efficiently

How would I shorten this? int[] a1 = {2, 0, 1, 4, 3}; int[] a2 = {3, 1, 2, 0, 4}; int[] a3 = {4, 2, 3, 1, 0}; int[] a4 = {0, 3, 4, 2, 1}; int[] a5 = {1, 4, 0, 3, 2}; ArrayList<int[]> array = new ArrayList<int[]>(); array.add(a1); array.add(a2); array.add(a3); array.add(a4); array.add(a5); ...

ArrayList and Array difference

With reference to MSDN, It is stated that "You can set the lower bound of an Array, but the lower bound of an ArrayList is always zero" If i declare an array a[10], the lower bound is always a[0]. Is this the lower bound specified there? If yes, How can we set the lower bound of an array, Since the index of an array always starts with...

ArrayList Search .net

Hi, Following is the format of the data stored in my arraylist. A-Amsterdam B- Brussels C-Canada so and so forth. I wan to search my array list by passing just the first few characters till '-' So if i have something like AA-Test then i want to pass just 'AA' to check if it exists or not. I know that i can use contains or binarysearc...

JSON to C# : convert an arraylist of doubles to an array of ints ?

I have an arraylist of doubles returned by a JSON library. After the JSON parser's decode method is run, we have this in the C# locals window: Name Value Type myObj Count=4 object {System.Collections.ArrayList} [0] 100.0 object {double} [1] 244.0 object {double} [2] 123.0 ...

Using SqlDataReader to fill an ArrayList?

I'm trying to implement a method which will take a given connection string and return an ArrayList containing the contents of a SQL view. I've verified the validity of the connection string and the view itself. However I don't see what the problem is in the code below. In debug, when it runs the ExecuteReader method and then try to ente...