Skip to main content

All Questions

Tagged with
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 ...
trusktr's user avatar
  • 45.1k
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 ...
Mark Denn's user avatar
  • 2,294
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 ...
majtits's user avatar
  • 39
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 ...
Mantas Vidutis's user avatar
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{ ...
A-moc's user avatar
  • 49
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, ...
Waleed Amjad's user avatar
  • 6,778
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
mouthpiec's user avatar
  • 3,983
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 ...
ElHaix's user avatar
  • 12.9k
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 ...
Sizemj's user avatar
  • 322
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. ...
Madison's user avatar
  • 71
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 ...
Tumble's user avatar
  • 53
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); ...
user avatar

15 30 50 per page
1
69 70 71 72
73