All Questions
1,092
questions
0
votes
1
answer
66
views
Counting the presence of a key in an object array; key won't be in every element
I have an arraylist of log entries containing the following:
[System.Collections.ArrayList]$aLog = @()
$aLog.Add([pscustomobject]@{status='200';desc='ok'})
$aLog.Add([pscustomobject]@{status='404';...
-2
votes
1
answer
74
views
Combining array lists containing different objects in Java
im working on a small game in Java. I have an abstract class SuperHero, and the classes WaterHero and LandHero that extends from Superhero. How do I combine the two objects allHeroes and allHeroes2 in ...
0
votes
1
answer
264
views
How to wrap object in array in java?
I'm making a code to send data to the payment gateway. I am a beginner in using java. I'm having a bit of trouble working with objects in an array in the item_details parameter. I've made the code as ...
0
votes
2
answers
110
views
Java: Print elements of User defined Classes using ArrayList [duplicate]
When I try to run the code I don't get 101,102,103 as output rather I get memory addresses of each value, I want to print the values 101,102,103 using "user defined class" pt_5_Employee as ...
1
vote
1
answer
45
views
Create new Object from a complex array of objects using Javascript
I have an array of objects and I want to push only the values of each object inside the array to a new object as a key value pair using Javascript.
eg:
const prices = [
{ ticker: 'msft', price: 14.3 ...
0
votes
1
answer
29
views
C# fails when adding ArrayList to Existing Object
Working in Visual Studio 2022 on an ASP.NET web app,
I have an object named tractObject with three items. The third item is an ArrayList that will hold a list of objects named standObject.
public ...
0
votes
0
answers
20
views
Trying to add an Object to an arrayList specified elsewhere
Whilst trying to make a class which I can use to add any object to an ArrayList from outside it I ran in to this problem:
public class AddToArrayList
{
public ArrayList stack;
...
-1
votes
2
answers
98
views
Cast object to int[]
I have a array (with type of Object) which I'm extracting from a System.Collections.ArrayList. And I'm now trying to cast this object to a int[] so i can use it to compare it with another int[].
Note: ...
0
votes
1
answer
100
views
Do-while loop ends program before while statement is met
Right now, I'm writing a program that will allow a user to create an infinite number of exercise objects, and will only stop when the user input is equal to certain a value. Below is the relevant code:...
0
votes
0
answers
17
views
I am trying to print out all objects from the array list question below but when ever I do it prints out a weird code? [duplicate]
public class Question{
private String question;
private String[] answers;
public int answerPosition;
public Question(String question, int size){
this.question = question;
...
0
votes
2
answers
1k
views
How can I store objects from another class in an ArrayList from a different class?
I am quite new to programming. I am creating a project where in class Countries there is data in the form of objects which contain the name of the country and the country's dialing code. There is ...
-1
votes
2
answers
156
views
How to remove object from an arraylist
its gonna seem complicated but I want to make a function that removes an object from the ArrayList of an object that is in another ArrayList
let me simplify it, there is a class with objects (students)...
2
votes
2
answers
857
views
Accessing specific elements in Arraylist of Objects
Really confused on how to access just the age of a specific student where all the information of students have been stored in a textfile. I am reading the textfile and storing that info into a student ...
0
votes
2
answers
66
views
searching in arraylist always not found
no matter what I use indexof() or contains or .equals() changing everything to uppercase or to lowercase It always return false and not found can someone please tell me what is going on?
class ...
0
votes
2
answers
94
views
How do i delete an object in an array which has a same name as another object in that same array?
I'm coding a simple fun project in Java, creating a loop which creates an object in an arraylist with the name+Random(1-60) (ex. Dog2, Dog6) 59 times.
And this loop, will check if an object it just ...