All Questions
1,092
questions
0
votes
0
answers
121
views
indexof returns negative 1 only
so I tried to find a value in an ArrayList and it always returns -1 even though I entered the value that does exist in the list.
I'm not sure maybe it's because I read them from a file?
public class ...
-3
votes
1
answer
102
views
When trying to overwrite a equals method in Java, it won't compare the values only the object itself?
In this exercise, I need to create a equals() method for a Drink class. Two drinks are the same if they have the same name and same size. I am receiving false from testing the method, even though I'm ...
0
votes
1
answer
266
views
Local Variable Memory Consumption
Which approach is better to declare local variable in terms of memory consumption?
public List<ResponseObject> mockMethod(RequestObject obj) {
List<ResponseObject> response = new ...
0
votes
3
answers
77
views
An Easier Way to Detect Differences Between Objects? (Java)
For instance, I have an arraylist called StudentListA and StudentListB that contains many students.
StudentListA = {Student 1, Student 2, Student 3....}
StudentListB = {Student A, Student B, Student C....
-3
votes
1
answer
366
views
How can I save only some elements of a List in an ArrayList? [closed]
I tried to do this, but the add in the line arrayList.add give me an error
List <Recipes.Results> list;
ArrayList <Recipes.Results> arrayList;
arrayList = new ArrayList&...
0
votes
1
answer
119
views
lerpColor on objects with Processing
I am currently working on creating a kind of drawing tool with processing, in which black ellipses are drawn with the mouse pointer, which after some time fade away completely to white - i.e. are no ...
1
vote
5
answers
1k
views
How to type-cast a nested Array of Objects into a nested List of Strings
Cannot create nested ArrayList from Array in Java
I am trying to create a nested list from an array.
But I have a problem while converting Object to String:
Object[] array = new Object[] {
...
0
votes
1
answer
79
views
Need to use an ArrayList to store objects, assignment requires I use an ArrayList, struggling to call the methods of the object from the ArrayList
I have no idea how to describe my issue in the right terms, sorry.
My assignment is pretty simple, but I am having a tough time with an ArrayList in c#.
If I had an array of objects and that object ...
-1
votes
3
answers
970
views
javascript create array item in 10 interval upto 100
I want to create array of object in javascript like interval manner which is dynamic like suppose interval value is 10 then it should start with 10 and end to 100
initial value = 10
end value = 100
so ...
0
votes
1
answer
58
views
Matrix defined with arraylist of objects in each cell
I want to implement in Java a map with defined dimensions and in each zone there could be 0 or many objects.
Example of non-functional code:
int[][] map = new int[10][10];
map[1][2] = new ArrayList<...
0
votes
1
answer
196
views
add object to list when made
How do I add a setting to a list while making it?
So for a program I am making I want to add a Object to a list without calling a function.
So i have
public static ArrayList<Setting> ...
-2
votes
1
answer
67
views
Create separate object of unique keys from array of object, JavaScript [closed]
How can we make separate objects of unique keys?
Below is the sample array:
var arr = [
{"name": "john"},
{"email": "[email protected]"},
{"phone": ...
1
vote
1
answer
57
views
Creating ArrayList of objects containing ArrayLists as parameters - my code does not seem to create individual ArrayLists?
I am running into problem with a code for a text-based game. My class Locations is meant to load parameters from a "config" text file to create objects.
My current approach is:
I have ...
0
votes
0
answers
26
views
Accessing methods of methods of interfaces directly created in Arraylist
I have created an ArrayList named Accounts and then directly created a object in it using add method. Is there a way in which I can access the methods of the object?
public class Main {
static ...
0
votes
1
answer
80
views
Issue with a Black Jack Game, changing a value of an Ace from 11 to 1 when the user points breaks 21
So I'm trying to make a Black Jack game in Java. However, I've been having an issue with making the user's Hand point value drop from when it goes over 21 and has an Ace. I thought this would be ...