Skip to main content

All Questions

Tagged with
1 vote
3 answers
77 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 ...
JSNoob's user avatar
  • 13
-1 votes
1 answer
76 views

How can i make a container of objects and how can i use it in other file

I basicly have an array list in my main class public static void main(String[] args) { List escenariosLi = new ArrayList<Escenario>(); String a = ""; escenariosLi.add(0,new ...
Leandro Zárate's user avatar
-1 votes
1 answer
57 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&...
jacob1989's user avatar
0 votes
5 answers
126 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 === ...
Alvaro Vasquez's user avatar
0 votes
4 answers
550 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-...
ayush's user avatar
  • 670
-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", "...
Shankar Kumar's user avatar
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": &...
mzaxhmars's user avatar
-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 ...
Lukas's user avatar
  • 25
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....
Ish Higareda's user avatar
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: [ ...
Puneeth's user avatar
  • 19
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 ...
Koi's user avatar
  • 3
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; ...
DaveM86's user avatar
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 ...
modadisi's user avatar
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[] { ...
user avatar
-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 ...
Harshal Kalavadiya's user avatar

15 30 50 per page
1
2 3 4 5
11