All Questions
1,092
questions
30
votes
3
answers
36k
views
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 ...
8
votes
4
answers
96k
views
C# objects in arrayLists
I'm working with ArrayList in C# and I am wondering how I can add objects to an ArrayList and then retrieve the values from it?
In short, how can I add, delete, edit and read from an ArrayList ...
3
votes
4
answers
12k
views
ArrayList of my objects, indexOf problem
I have problem with Java's ArrayList. I've created an Object, that contains two attributes, x and y. Now I've loaded some object in my ArrayList. Problem is that I don't know how to find index of some ...
323
votes
10
answers
601k
views
How does a ArrayList's contains() method evaluate objects?
Say I create one object and add it to my ArrayList. If I then create another object with exactly the same constructor input, will the contains() method evaluate the two objects to be the same? Assume ...
5
votes
3
answers
26k
views
java: <identifier> expected with ArrayList
I have a class named Storage. Storage contains an arraylist of special objects called Products. Each product contains information such as name, price, etc. My code is as follows:
class Storage{
...
0
votes
3
answers
4k
views
Objects in Java ArrayList don't get updated
SOLVED:
This is what was wrong:
current.addFolder(folder); (in the final else clause of the if statement)
Added a new folder, but did not guarantee that the folder passed is the folder added, ...
17
votes
4
answers
42k
views
How to check the type of object in ArrayList
Is there a way to get the type of object in the arraylist?
I need to make an IF statment as the following (in C#):
if(object is int)
//code
else
//code
thanks
0
votes
1
answer
84
views
Using SubSonic, how to add a field to a pre-defined class?
I've got a SubSonic DAL - works great.
Two classes: TblReceipt and TblReceiptLineItems.
I can create a parallel class of TblReceipt, but seems like a waste, so here's what I need to do:
Have a ...
0
votes
1
answer
60
views
Why is this JText panl giving me amemory address?
This is an undo feature button on a calculator that I am writing. undo is the button Status is a class that holds my status. listOfStates is an ArrayList of Status. displayBox is a object of ...
0
votes
5
answers
2k
views
Java ArrayList Help!
I am working on learning java a little, and i found this question in a java text book on Google books, I have been working on it for a while, and for some reason these seems like it should be simple. ...
0
votes
3
answers
5k
views
Selecting objects contained in an ArrayList
I'm working on a project for homework where I have an ArrayList containing 5 strings. I know how to select items of the ArrayList (using an index value) but not how to access the objects strings. Any ...
1
vote
2
answers
904
views
ArrayList object sorting
I have to sort ArrayList which consists of objects. Object: ID, Quantity. The ArrayList should be sorted by ID. How to implement this?
ItemIdQuantity = new ItemIdQuantity (ID, Quantity);
...