All Questions
9
questions
0
votes
1
answer
509
views
How do I correctly use a removeBook(Book) method which takes a Book as an argument
I am asked to create a method called removeBook(Book) which takes a Book as an argument. I have two classes Library and Book, I am using an ArrayList<Book> and an Iterator<Book> in my ...
3
votes
1
answer
70
views
Change value of arraylist field where object exists
I need some help cause I got stuck. I have an ArrayList called orderList with type ItemOrdered(int quantity,Item item). I want to set a new value for item's quantity where the given item exists into ...
0
votes
2
answers
91
views
how to get value from oject referece in java
So I have ArrayList of ArrayLists and I'm using for example outer.get(0)
in order to get the first ArrayList but I'm only getting the object reference I'm new to java please help me. Here is my code ...
-2
votes
1
answer
92
views
Reference Object in Array List
updated question
Hello,
I currently have a problem understanding how Objects are referenced in Array Lists, or to be more explicit how using the get method of an array list really works.
I add 4 ...
3
votes
1
answer
628
views
is there any way to copy a java arraylist object into codemodel generated source?
i have a populated arraylist (non-codemodel) in a code generation class using codemodel, and i would like to use it in the generated code. is there any way to do this? it's "crossing worlds" a little, ...
0
votes
1
answer
81
views
ArrayList clone still referenced?
i know that ArrayList objects are only passed as reference, and i found a lot of articles here about that topic.
Still, even with cloning the ArrayList to a temporary one nor with copying the Point[] ...
1
vote
4
answers
3k
views
How to copy a HashMap to an ArrayList with different references
I am having a problem with the references of objects in Java. Here's the situation.
Let's say I have an object class called MyObject.
class MyObject {
Long id;
String item;
...
1
vote
3
answers
1k
views
Java: My new object instantiation is changing a previous object reference
I am trying to figure out what is going on here and would appreciate any help. I have a loop where I am creating new objects and then adding them to an ArrayList. But it seems as though each time ...
2
votes
7
answers
175
views
Question about Referencing Strings in C#
Quick question.
Take the following code sample:
ArrayList arrayList = new ArrayList();
string testString = "";
testString = "test";
arrayList.Add(testString);
In that code sample, if I were to do ...