arraylist

Trying to get each line of a text file to be an arraylist

alright so I am trying to read a text file. and then split it up into lines which actually represent processes in a process table arraylist. then i want to split up all the tokens in the line and make all the tokens of the line an arraylist again so far this is all i have: its not working correctly. i am getting: processes:[[netscape,...

java.lang.IndexOutOfBoundsException: Index: 4, Size: 4

How can I fix this OutOfBoundsException? Here is the code I am using: ResultSet rsTagCheck = stmt.executeQuery( "SELECT PARKING.XKRPRMT.XKRPRMT_PIDM, PARKING.XKRPRMT.XKRPRMT_STATUS, PARKING.XKRPRMT.XKRPRMT_EXPIRE_YR, PARKING.XKRPRMT.XKRPRMT_TAG FROM PARKING.XKRPRMT WHERE XKRPRMT_PIDM ='" + BannerID + "'"); while (rsTagCheck.next...

When to use ArrayList over array in recursion

So I have this problem. I was trying to code a program to print all the valid possible arrangements of brackets i.e. for 3 brackets we can have ((())), (()()), ()()(), (())() etc. I have a working code public static void main(String[] args) { int number = 3; // No. of brackets int cn = number; int on = number; // open ...

ArrayList object to array of Point objects

I have a custom class CurvePoint which I define a set of data items to draw on the screen using DrawCurve I written a cast routine to convert CurvePoint to Point, but I am getting the error At least one element in the source array could not be cast down to the destination array type. when I try to use the .ToArray method in an Arrayli...

How to sort the array list?

Hey Guys. thanx for the major help regarding my obstacles. What my problem this time is, how can I sort the array list that is provided in my code basically dont know WhatI need to add in the provied code below, just to simplyfive it I got 3 arraylist that i want to make them into one arraylist, so they can be sorted in amont of guesses ...

How to display the contents of an arraylist in a drop down box

I have a sql statement that pulls infomration about tagnum's for individual pidm's. Every pidm can have multiple tagnum's so I am dropping the information into an arraylist. I want to display the contents of this arraylist in a dropdown box on a html page. Here is the code for the arraylist: <table style="border:transparent" st...

Hibernate -> ArrayList cannot be cast to Set

Hello! I have a Java EE application and I use Hibernate. The domain objects, I changed the List / ArrayList to Set / HashSet, because it is better to use Sets. But in my Dao implementation I run into a problem: public Set<Person> getAllPersons() { SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); Session sess ...

How to read values from the ArrayList of Structures?

I am using the following code in C#. I am adding the values into the arraylist by using index. Now I want to read the values from the arraylist by using the index only. In the following example I am simply reading all the values from the arrylist but I want to read the values from the arrylist based on index( for e.g Customer_Details[i]...

android file download

Hallo guys, im here in austria how are you doing? i have startet developing android and writing my own small app that gets files from a server to display the information in a ListView. I really spent a day to look after the best and easiest way to get files from a server. However i wrote the program and tested it - and now i have a seri...

Removing Duplicate from Arraylist and Getting the duplicate of one property in a list

Hi all, i have one arraylist say "templist" it will have items of item say "Stool" now list contains duplicates 1 abc wwww.com lob1 1 abc wwww.com lob2 now i want like 1 abc wwww.com (lob1,lob2) may be a separated list of lob's alone. how we can do it ? please help List tempList = new ArrayList(); I added items of...

In Java, How do you quicksort an ArrayList of objects in which the sorting field is multiple layers deep?

Basically, I have a Container class called "Employees" which has in it an ArrayList. This ArrayList contains "Employee" objects, which in turn contain "EmployeeData" objects which in turn contain String objects such as "first" or "last" (which are employee names). Here's a diagram of the ArrayList structure: ArrayList[Employee] emps ==...

When you make an ArrayList without specifying the object type, does it create it automatically when you add the first object?

For example, instead of doing ArrayList<ClassName> variableName; you do ArrayList variableName; then later you add an object of type "ClassName" variableName.add(objectName); will that automatically set the type of your array as ArrayList<ClassName> ? ...

Use of contains in Java ArrayList<String>

If I have an ArrayList of String forming part of a class in Java like so: private ArrayList<String> rssFeedURLs; If I want to use a method in the class containing the above ArrayList, using ArrayList contains to check if a String is contained in this ArrayList, I believe I should be able to do so as follows: if (this.rssFeedURLs.co...

Java NullPointerException when adding to ArrayList

My code is throwing a NullPointerException, even though the object seems to properly exist. public class IrregularPolygon { private ArrayList<Point2D.Double> myPolygon; public void add(Point2D.Double aPoint) { System.out.println(aPoint); // Outputs Point2D.Double[20.0, 10.0] myPolygon.add(aPoint); // NullPointe...

Java 1.6 java.lang.IndexOutOfBoundsException Question

I seem to be getting an array out of bounds exception but the problem is the error message and my System.out and eclipse's debug tools tell me conflicting information. This is my exception: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 9, Size: 9 at java.util.ArrayList.RangeCheck(ArrayList.jav...

How to choose ArrayList element according to a user choice

I have an ArrayList containing Movies. ArrayList<Movie>movies = new ArrayList<Movie>(); Movie has a property int movienumber. The user can select a movie according to the movienumber, by entering the desired number into the console. I store the users choice inside a field moviechoice. How can I store the user-selected movie in th...

adapters notifyDataSetChanged does not work

EDIT 2: I did solve my problem, but i don't know how:S I was moving my code snippets a bit around, a suddenly it worked. Must have done something in the wrong order, but its weird, checked it many times. Thanks for you help, and sorry I can't post an answer ;) Hi. I have a list view which I'm trying to refresh to update it self when i...

Java ArrayList.remove() not decrementing the Size of the ArrayList.

I have an ArrayList to store some data, but whenever I remove an item from the list, the size does not decrease, even when I call ArrayList.trimToSize(). This is causing me nullPointerExceptions. How can I remove a single item from an ArrayList and have the list's size() shrink accordingly? EDIT: All right, here's the code. Here's a bi...

Accessing a class after removing from a queue

----What I'm doing---- So I have an assignment that takes an input of characters then calculates the capital gain for the string using a queue. I'm stripping the input data then putting it into an arraylist that I then queue. I'm suppose to then dequeue the data to calculate the the capital gain. ----The problem---- The problem I'm ha...

What's the C++ version of Java's ArrayList

Just getting back into using C++ and trying to convert a simple Java program I wrote recently. What's the preferred equivalent to the Java ArrayList in C++? ...