All Questions
1,092
questions
-2
votes
2
answers
99
views
How to parse an objects with array index to object array with key value pairs
Convert this object Students object to one Students array
{"SubmitBy":"SK", "Students[0].name":"Jhon", "Students[0].age":"15", "...
-2
votes
1
answer
2k
views
How to display a list of objects as a JList in java swing?
We are asked to build a system in Java Swing no drag and drop and I cannot understand how to display a list of objects in a JList.
I have a GUI class that creates a JFrame, JPanel, and an empty JList ...
0
votes
3
answers
744
views
How to get data from List<Object[]> using java 8
Trying to get a data from DB using JPA. My Data format was like [[John,Wick,New York],[Walter,White,New Mexico]]
And am using below code the get the data from List<Object[]> and with iteration ...
0
votes
1
answer
77
views
Referencing an interface from ArrayList
I am having trouble understanding ((Edible)objects[i]).howToEat() at line 7 in the java code example given below. Edible is an interface which contains abstract method howToEat() and I understand that ...
2
votes
3
answers
204
views
Group an array of objects based on multi keys in Javascript?
I would like to share with you an existence problem
I have array as follows
const data = [
{
"countries": ["France", "USA", "Canada"],
"city": &...
-1
votes
2
answers
76
views
Java - from Array to linked ArrayList why it doesn't affect all int values?
I am studing Java, i have simple Array linked to ArrayList, it is fixed size i can change values inside array or list without change length.
So i tried to change all elements of the Array to see ...
0
votes
1
answer
38
views
how to return numbers by column from objects that have array list attribute
I have a class where I am creating different "Processes", an attribute of this class is an linked list of Integers. I have created different class objects and to make it easy to loop through ...
0
votes
2
answers
317
views
Java.lang.NumberFormatException when trying to read in a file, so I can use the data with my objects
I keep getting this error when I'm trying to read in a file and add the data to my objects. Can someone please help me? Here is the error:
Exception in thread "main" java.lang....
-1
votes
1
answer
24
views
I'm doing an assignment for my class where I need to create the functions below for a Path. I'm having trouble on the functions, am I overthinking it?
import java.awt.Point;
import java.util.ArrayList;
import java.util.Scanner;
public class Path
{
ArrayList<Point> pointOne;
ArrayList<Point> pointTwo;
public Path() {
...
0
votes
1
answer
53
views
JAVA Attribute of ArrayList<Object> not returning values
Class Hospital
package app;
import java.util.ArrayList;
import app.Department;
public class Hospital {
String hospitalId;
String hospitalName;
int departmentCount;
ArrayList<...
0
votes
2
answers
164
views
How to create an object from a file?
I've a file with a line that looks like this "Room,home,You are in your home"
I wanna read the file and then create an object (I have created a class called Room), what I wanna do now is ...
0
votes
2
answers
28
views
How to join the objects that have the name in common and do the sum of the values of the key value1 and value2. Javascript
I have an array with the following objects:
const arrayData = [
{name: 'John', car:'BMW', value1: 500, value2: 350},
{name: 'Paul', car: 'AUDI', value1: 290, value2: 200},
{name: 'John', car:'BMW', ...
1
vote
2
answers
63
views
Javscript/TypeScript: Find the key and append value as an array
I have an object which is like
[{
Date: 01/11/2022,
Questionnaire: [
{Title: 'Rating', Ans: '5' },
{Title: 'Comment', Ans: 'Awesome' }
]
},
{
Date: 01/11/2022,
Questionnaire: [
...
0
votes
2
answers
447
views
How do I return a specific object from an ArrayList?
So I'm trying to implement a method in a Grid class that returns the tile (which is an instance of the tile class) specified by two coordinates the user inputs. But I have no idea how to go about ...
-1
votes
1
answer
46
views
deleting duplicate objects from an arraylist
I have an array list consisting of objects defined in the class Result(date, name, grade). I have managed to sort the dataset. However I want there to be no duplicates, only the object with that has ...