All Questions
159 questions
1
vote
3
answers
101
views
Can an object belong to both an array and arraylist simultaneously in Java?
I am struggling to write a code sample where an object can belong to an array and arraylist simultaneously and where modifying in arraylist or the array changes the object? See example where I was ...
-1
votes
1
answer
72
views
How to add objects to list without having array brackets
I have a for loop in which I add some attributes to the object and at the end I need to have a string (to pass it as a query parameter)
I need
{"items":[{"itemsCode":"item1&...
0
votes
4
answers
143
views
How to print a name by a given ID
var people = [
{name: 'John', id: [34, 44, 77]},
{name: 'Jose', id: [43, 54, 65]},
{name: 'Hanna', id: [56, 34, 98]}
];
var peopleFinder = people.filter(function(b){
return b.id === ...
0
votes
4
answers
891
views
Difference between Array and ArrayList<> in Java in terms of memory allocation?
I came accross an article which had a question-
Contiguous memory locations are usually used for storing actual values in an array but not in ArrayList. Explain.
https://www.geeksforgeeks.org/java-...
-2
votes
2
answers
101
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
3
answers
209
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
79
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
2
answers
382
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
vote
2
answers
70
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
793
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 ...
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
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 ...
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[] {
...
-1
votes
3
answers
1k
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 ...
-2
votes
1
answer
68
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": ...