All Questions
17
questions
0
votes
1
answer
39
views
How do I access all of my input from my loop so I can store it as an object?
I am reading a small file (using Java scanner), parsing the lines into specific strings, and storing the information from the strings into an object. I can only access the last element, but when I ...
1
vote
2
answers
91
views
(Java) I cannot loop over my arraylist object?
I'm trying to loop over an ArrayList object but I only get the following:
Name & Education:
com.company.Item@69d9c55
I have no clue why this is happening. I'm using the code provided in the MOOC ...
0
votes
1
answer
121
views
generate New set of Array patterns from loop in javascript
Hi i have one object datatype from that i need to generate New array patterns for filtering the operation, but somehow i could not reach my expected output pattern from the below code, dono where i ...
1
vote
2
answers
426
views
Loop adds the same object to all elements of my arrayList
I’m trying to get this loop to put each line from a file in an object, then store each object in an arrayList. For some reason the loop stores the first three lines of the input correctly, but when it ...
0
votes
2
answers
54
views
filter array of objects by property and get storeID associated to it
I am new to stackoverflow. So pardon if i don't represent my question correctly.
I have a specific requirement for array filtering and getting property details from it when search criteria matches. ...
0
votes
2
answers
79
views
How to loop through an ArrayList within a custom Object?
I realize that variations of this question have been asked before, but I am having a uniquely difficult time figuring out how to complete the following task:
I have an object that looks something ...
0
votes
3
answers
84
views
Why is my loop not retrieving the last items?
I am trying to implement a method to view a list of items and their quantities, without being repeated. I am doing this using ArrayList which will hold objects of the type Item which I created. The ...
0
votes
1
answer
65
views
Creating a correct loop structure to populate a list of objects
I have a list of objects, each has two fields, name and weight. I need to populate and calculate the weights from those list that will fulfill a parameter of an object in list of other objects, ...
0
votes
0
answers
25
views
How to add information to objects that take 2 IDs as parameters without over writing it when info is added again?
So, ill start with a brief explanation so that my code makes sense. We are reading a file through a scanner and adding every "N" lines to a "Block" that carries those lines (Basically an array list ...
0
votes
2
answers
54
views
How to fill a List<CustomObject> with variables taken from a List<Integer> in a loop?
I have a list of Integers as
List<Integer> list = new ArrayList<Integer>();
of numbers taken from a database (this list contains 46 different numbers) and I have to fill a list of custom ...
-1
votes
1
answer
20
views
If I make an object using a list and the same constructor, does that mean after I make it I can no longer reference it?
I've created the following code to make Region objects that have information in them. (Coordinates, election data, etc). I'm wondering if I can no longer reference these after they are put into the ...
14
votes
5
answers
43k
views
Remove object from ArrayList with some Object property
I am maintaining one ArrayList of objects. And my object structure is Id, name, some other details. I need to remove one the object with some id value say(10) and I don't want to iterate over the list....
0
votes
3
answers
74
views
Copying double ArrayList containing objects in Java (ArrayList<ArrayList<Object>>>)
Ok, so I earlier posted a thread which answered alot of my questions and helped me improve my code, However, I have run into another problem, where well, I dont know why, but I think maybe the copy ...
-3
votes
2
answers
108
views
Explanation of a few lines of code
I'm having a little difficulty understand these lines of code.
ArrayList<Member> results = null;
try {
results = MemberSQL.member();
} catch (SQLException e) {
// TODO Auto-generated ...
2
votes
5
answers
2k
views
1D array printed as 2D Java
I'm trying to print a sparse matrix from an array list where each object in the list comprises of a pair. The pair (object) holds two integers- position and value. [pos,val].
The position is the ...