arraylist

Pass by reference not returning in RMI for ArrayList

I've got an RMI call defined as: public void remoteGetCustomerNameNumbers(ArrayList<String> customerNumberList, ArrayList<String> customerNameList) throws java.rmi.RemoteException; The function does a database lookup and populates the two ArrayLists. The calling function gets nothing. I believe this works with Vector types. Do I nee...

C#: Is Implicit Arraylist assignment possible?

I'd like to populate an arraylist by specifying a list of values just like I would an integer array, but am unsure of how to do so without repeated calls to the "add" method. For example, I want to assign { 1, 2, 3, "string1", "string2" } to an arraylist. I know for other arrays you can make the assignment like: int[] IntArray = {1,2...

How do I find out what type each object is in a ArrayList<Object>?

I have a ArrayList made up of different elements imported from a db, made up of strings, numbers, doubles and ints. Is there a way to use a reflection type technique to find out what each type of data each element holds? FYI: The reason that there is so many types of data is that this is a piece of java code being written to be implem...

ArrayList in Java and inputting

I'm used to python, so this is a bit confusing to me. I'm trying to take in input, line-by-line, until a user inputs a certain number. The numbers will be stored in an array to apply some statistical maths to them. Currently, I have a main class, the stats classes, and an "reading" class. Two Questions: I can't seem to get the input l...

How to have a LinkClicked event using an ArrayList of LinkLabels in .NET

I'm working on a form that will display links to open different types of reports. This system has different types of users, so the users should only be able to see the links to the types of reports they can access. Currently, the way I have this set up is that I have an ArrayList of LinkLabels, but the problem I'm having is how to have...

How to create ArrayList (ArrayList<T>) from array (T[]) in Java

I have an array that is initialised like: Element[] array = {new Element(1),new Element(2),new Element(3)}; I would like to convert this array into an object of the ArrayList class. ArrayList<Element> arraylist = ???; I am sure I have done this before, but the solution is sitting just at the edge of my memory. ...

How to convert ArrayList to an array of structure?

Here I have: Public Structure MyStruct Public Name as String Public Content as String End Structure Dim oStruct as MyStruct = New MyStruct() oStruct.Name = ... oStruct.Content = ... Dim alList as ArrayList = new ArrayList() alList.Add(oStruct) I'd like to convert the ArrayList to a static strongly-typed Array of type MyStruct....

How do I remove repeated elements from ArrayList?

I have an ArrayList of Strings, and I want to remove repeated strings from it. How can I do this? ...

Why this code is not working ?

Hi guys I wrote this code and i have two errors. Invalid rank specifier: expected ',' or ']' Cannot apply indexing with [] to an expression of type 'int' Can you help please? static void Main(string[] args) { ArrayList numbers = new ArrayList(); foreach (int number in new int[12] {10,9,8,7,6,5,4,3,2,1}) //...

Retrieving records from MySQL in Java

I'm building an application in Java to retrieve data from MySQL database. After executing a query I get a ResultSet and do the following to extract records: while (rs.next()) { for (int column = 1; column <= rm.getColumnCount(); column++) { row.add(rs.getObject(column)); } resu...

Using Lists in C#

I am an upper level Software Engineering student currently in a Data Structures and Algorithms class. Our professor wants us to write a program using the List structure found in the C++ STL. I have been trying to use C# more and more, and was wondering if the ArrayList structure in .NET is a good substitute for the STL List implementat...

Randomize a List<T> in C#

What is the best way to randomize the order of a generic list in C#? I've got a finite set of 75 numbers in a list I would like to assign a random order to, in order to draw them for a lottery type application. thx! ...

How to backup ArrayList in Java?

I have some data stored as ArrayList. And when I want to backup this data,java bounds two objects forever. Which means when I change values in data ArrayList this changes come to backup. I tried to copy values from data separately to backup in the loop, tried to use method data.clone() — nothing helps. ...

How do I bind an ArrayList to a PreparedStatement in Oracle?

I was wondering if there was a way to bind an ArrayList (or any kind of List, for that matter) to a PreparedStatement which will eventually be used to access an Oracle database. I found: http://stackoverflow.com/questions/178479/alternatives-for-java-sql-preparedstatement-in-clause-issue And that seems similar to my issue, but this qu...

Search for a regexp in a java arraylist

ArrayList <String> list = new ArrayList(); list.add("behold"); list.add("bend"); list.add("bet"); list.add("bear"); list.add("beat"); list.add("become"); list.add("begin"); There is a way to search for the regexp bea.* and get the indexes like in ArrayList.indexOf ? EDIT: returning the items is fine but I need something with more per...

Is the order of an arraylist guaranteed in C#.NET?

If I'm using an ArrayList in C#.NET, is the order guaranteed to stay the same as the order I add items to it? ...

Casting between ArrayLists in Java

Hi Sorry, I thought this was an inheritance question: it was an ArrayList question all along! Ok, my problem is more specific than I thought. So I have two families of classes. Cards, and Zones. Zones are boxes for holding card. The first two subClasses of Zone, ZoneList and ZoneMap are meant to be two different ways of storing Cards...

Problem with ArrayLists and reading a file

I am having difficulty with the following method. I can't figure out if my problem is, but I have narrowed it down to not populating the array list from the file. Any help is greatly appreciated. private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) { //create arraylists ArrayList<String> model = new ArrayList<Stri...

ArrayList vs List<object>

I saw this reply from Jon on Initialize generic object with unknown type If you want a single collection to contain multiple unrelated types of values, however, you will have to use List<object> I'm not comparing ArrayList vs List<>, but ArrayList vs List<object>, as both will be exposing item of type "object". What would be ...

When to use a linked list over an array/array list?

I use a lot of lists and arrays but I have yet to come across a scenario in which the array list couldn't be used just as easily as, if not easier than, the linked list. I was hoping someone could give me some examples of when the linked list is notably better. ...