Questions tagged [arraylist]

A simple collection data type found in some languages / platforms (such as in Java or .NET). The array list implements a list using an array, benefiting from both the DSs strengths.

0
votes
0answers
14 views

How to create checkboxs that fetch from database and pass on value

I am new to php and can not turn a row into a checkbox field that passes onto a separate page. if ($result = $db->query($sql) ) { //*start of original if ($result->num_rows &...
-2
votes
0answers
43 views

The type ArrayList is not generic; it cannot be parameterized with arguments <String> [on hold]

I am following an example in a textbook and am trying to create an ArrayList: import java.util.ArrayList; public class ArrayList { public static void main(String[] args) { ArrayList<...
-2
votes
1answer
29 views

For each loop to add all population

I don't know what to do with "For each loop". i am trying to add up all the population. i keep getting an error with the for each loop. the error says " cannot applied to given types" can someone ...
0
votes
2answers
33 views

How to print all words with a specific length and a multiplication of that length

I need to print all the given words in the array, if I type in a number above 2. And if I give for example the number 4, it should also print the length of the words with the multipcation of 4, so it ...
0
votes
3answers
14 views

Convert two array into JSON object

I am trying to build JSON from two array. One array contains field_name and other contains field_value of corresponding field_name var field_name = ["sys_id","country","calendar_integration","...
0
votes
4answers
45 views

How to get indexOf element which isn't the first

Assumed ArrayList<Integer> list = Arrays.asList(new Integer[] {1,2,3,4,5,6,1,8,9}); Find second occurence I want to get the index of the second finding of the (multiple) contained element "1"...
2
votes
2answers
40 views

Adding integers to an ArrayList depending on the modulus of their indexes

import java.util.*; public class AddingIntegers{ public static void main(String []args){ ArrayList <Integer> list = new ArrayList<>(Arrays.asList(10,20,30)); add(...
0
votes
0answers
13 views

MS Access Retrieve Values from ListBox

This is my first time dealing with multi-select lists in Access. I have a report form with some dropdowns, checkboxes, and a listbox. The listbox contains almost 70 items - Let's call them "Cities". ...
-4
votes
0answers
26 views

How do I Create Null ArrayList in Java/Java 8

I have below Java code wanted to create arraylist object from it. Could some one help me on this? public class NullArrayList { private Object listOrSingleEl; void addToList(...
-2
votes
0answers
22 views

Tracking System with ArrayLists [on hold]

I am trying to make a tracking system for monthly fee of a building complex -I am not sure if there is a word in English for it, but basically it’s following whether a flat paid their fee. I am using ...
-3
votes
0answers
29 views

Java - ArrayList custom object to Json eror

I am working on a project and found these common mistakes which I don't know how to fix or how to approach the problem. Code: JSONObject root = new JSONObject(); JSONArray container = new ...
-2
votes
0answers
39 views

When trying to iterate through a STRING ArrayList, I'm having issues pulling a specific value. It keeps skipping

public void list(String a, String b, int x) { /* fourth method to display information */ System.out.println("List of people"); if (a.equals("f") && b.equals("t")) { System.out....
-2
votes
4answers
29 views

How to grab first element in a python list and check if it is None?

How can I grab the first element in a list and check if it is None? a = [None, None, 1234, 'Apple', 1] b = [None, 4321, 'Cheese', 1] I want to grab the first element in list a and list b and ...
0
votes
1answer
57 views

Creating an Arrylist in a Arraylist in Java

This is my first post so sorry if I mess something up or if I am not clear enough. I have been looking through online forums for several hours and spend more trying to figure it out for myself. I am ...
0
votes
2answers
75 views

NullPointer when trying to access a Java ArrayList<User> that is NOT null

I have an ArrayList within my UserController that stores all my User instances. I am able to use my setUserList to successfully set the ArrayList as I am able to loop through and print the users ...
0
votes
1answer
20 views

Remove object from list on child removed android

I have an arrayList of objects of a class. This class contains data received from Firebase. but I want to remove an object from the list when a child is removed in firebase, but two objects don't ...
1
vote
0answers
34 views

Java MouseListener and ArrayList

My program creates Circles and Squares and places them in the center of a DrawZone. What I want to do is to move them to the point where I click with my mouse. For this purpose, I use MouseListener. ...
0
votes
2answers
48 views

How to write a toString method using nodes in java

So, I'm not quite sure what is wrong with my toString method. I just keep having an error when I run my tests that it's incorrect. Basically what I am doing is implementing a cyclic ...
0
votes
1answer
27 views

How can I control the Recycle View by clicking on the date of the calendar view?

I'm new in android and also new in English sorry my bad English... I have learned android course at the academy. My sentence may be wrong because it is written through a translator. I hope you ...
0
votes
1answer
27 views

Drools: Compare 2 Arraylists from the same Object

I have a Class and this Class constructs 7 ArrayLists: public class Fruchtplanungsmodul { private ArrayList<Crops> fruchtliste1F; private ArrayList<Crops> fruchtliste2F; ...
0
votes
0answers
27 views

The method change(Bar, Bar) is undefined for the type ArrayList<Bar>

I am trying to change the value of a 'Bar' object, I've created a change method that takes 2 bar variables, however when I try and use it on 'list.get(i)' within the compareBar method I get an error ...
1
vote
3answers
41 views

How to convert Arraylist into 2D double[][] array

I have an ArrayList which has objects of Coords which are x and y: ArrayList<Coords> positionsArrayList = new ArrayList<>(values); class Coords { int x; int y; public ...
-2
votes
0answers
48 views

index outOfBounds while using arrayList in android

i try to drop the players (objects) in 3 diffrent lists and by run for the index it's checking if the player is already exists in the list. i can't understand why he said index outOfBounds. i need the ...
0
votes
1answer
31 views

Simple CSV File comparison in JAVA

I am using the below code to compare two CSV's file1 and file2. Where file1 is the file which needs to be compared with file2 always, It does the partial work that I need but doesn't accomplish all. I ...
0
votes
2answers
27 views

Python list splicing for 2D array

matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]] matrix[3][1:] = matrix[3][0:-1] print(matrix) gives the following output: [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, ...
0
votes
0answers
28 views

Set object value inside arraylist

In the following code it is suppose to fill the forecasted unites in the Account only if the Report date received from the cursor is within the Forecast start and end dates and, the Item id = to the ...
0
votes
0answers
12 views

struggling to data processing ADFA-LD dataset using ngrams

i have 3 different classes to help process a dataset. what im trying to figure out is if i can combine the 3 classes together to create 1 program that saves me time from running each algorithm ...
-1
votes
1answer
44 views

Arraylist contain, & retain all not giving the same result as Sql inner join

Sql output : 312 Sql Script inner join: SELECT count(*) FROM COST_TYPE_SELECTION CST LEFT JOIN GBL_HYPACCT_RSLV_TBL_NEW_CA GBL ON GBL.TREE_NODE = CST.GL_TREE_NODE AND GBL.TREE_LEVEL = CST....
0
votes
0answers
39 views

Cannot Access properties under Non-Public members in C# [on hold]

I want to access the highlighted "Description" property under Non-Public members as mentioned in the picture I have tried the below code without success Type objType = PaySub.Request.DataError....
0
votes
1answer
33 views

Create unique list of objects by any property

i'm trying to create Generic class that will have behavior of List but accept Field of String as a name of the property that should determine the uniqueness. For example we have class User: public ...
-1
votes
1answer
45 views

Convert ArrayList<ArrayList<Integer>> to List<List<Integer>>

I have my Integer data in Array Lists of Arrays Lists and I want to convert that data to Lists of List format. How can I do it? public List<List<Integer>> subsetsWithDup(int[] nums) { ...
-1
votes
0answers
9 views

Null pointer exception between Gui and classese [duplicate]

I'm tryin to create a new customer with the name I read from textfield, it give me Null pointer exception at Pro.gui.newcus(gui.java:128) at Pro.gui.lambda$0(gui.java:119) but I don't know why, here'...
0
votes
1answer
49 views

How to remove an item from List<>?

I'm developing an app, which contains a list of tickets, there are add ticket and remove ticket options for the user. The add option works fine, but the remove option doesn't, here is the ticket list ...
1
vote
2answers
35 views

Java Lists: Difference between assignment while instantiating and after

This error only occurs when I assign values to an arrayList after it has been Instantiated. This is the Error This only occurs when the code is like this: String line = scanner.nextLine(); line = ...
-1
votes
1answer
38 views

ArrayList add Elements

I'm a absolute beginner in Java and I searched for half an hour, but I just can't figure out why the following code won't compile: public class Main { ArrayList<Integer> path = new ...
0
votes
0answers
52 views

Java: How can I find the most repeatable sequence of common numbers in an Arraylist<Integer>? [duplicate]

I need to find the most repeatable sequence of common numbers in an Arraylist<Integer> and then to show it on the screen. For example: the Arraylist will be 992222223555 and the program have ...
0
votes
0answers
13 views

error: cannot find symbol variable Lists in Lists.newArrayList? [on hold]

i wanted to use a library from GitHub but it gives me an error on : "Lists" here is my code: private List<String> getTitles(){ return Lists.newArrayList("1", "2", "3", "4"); } private List&...
0
votes
1answer
26 views

Can't save more than 2 Elements in ArrayList to MySQL with SpringBoot?

I can't save more than 2 Elements in ArrayList to MySQL with SpringBoot. When i make a post request (Postman or with Alamofire) with one object in array i get status code 200 otherwise I get status ...
0
votes
1answer
46 views

How to read multiple integers without symbols out of arraylist?

I need to read multiple integers which are written in the format (4, 5), 242. There are 10 lines and each line differs from the other. For example the second line could be something like (11, 24, 5, 6,...
-1
votes
0answers
32 views

Adding an object to an list overwrites the previous values [duplicate]

So I'm using this shipping API to create multiple labels, below I have a button to queue the labels. While the code does run successfully my entire output is the same as the last item the was queued. ...
-1
votes
6answers
72 views

Why does my ArrayList print the first object 3 times?

I am relatively new to Java. I was practicing an exercise where we explore the polymorphic behavior of subclass and superclass instances. This exercise builds on the concepts of abstract classes and ...
-3
votes
2answers
31 views

What's the best way to pass a whole recyclerview to another activity using Intent? [on hold]

My RecyclerView in one activity is made up of an ArrayList of my custom object. Because this activity is in the edit mode, I would like to pass all the contents of this RecyclerView into another ...
0
votes
3answers
34 views

Pulling a range from an array

So I don’t want anyone to solve it but just help me out in terms of working a certain part. So out of the array I have to print a certain numbers that fit within the range given(0 & 50). Besides ...
-4
votes
0answers
33 views

read from file with if

hi Good morning need help with this code want to read from file in these 2 ArrayList which line start with "H" stored in hempList and so on. public void hireEmployee(String fileName) throws ...
1
vote
1answer
28 views

selectionSort method that'll sort an ArrayList by type

SOF. I have a problem which I'm having some difficulty with. The following code is supposed to sieve through the file line-by-line, utilizes the StringTokenizer effectively to get the Car Class's ...
-3
votes
1answer
30 views

Convert String to JSONArray (or any array)

Im trying to parse the following value paramter to a JSONArray (or any other array): "value":"[{\"fileName\":\"Instructions.docx\",\"filePath\":\"http://someserver/api/files/somefilereference1\"},{\"...
0
votes
1answer
27 views

Java rest server: avoid the removal of an item while processing it

I have an arrayList which is static in the class. In the beginning of each request, I remove all the obsolete items: arrayList.entrySet().removeIf(entry -> entry.getValue().isObsolete()); The ...
0
votes
0answers
15 views

How to sort data read from a textfile and then display the unsorted and sorted data in a GUI?

I have this constructor class for the make,model, year and mileage of a car. public class Car { private String make,model; private int year,mileage; public String toString() { return "Car [make=" + ...
2
votes
1answer
31 views

Adding multiple “randomly generated” objects to ArrayList results in adding the same object multiple times

I have a class Ttp which has a ArrayList<City>loaded from file. In constructor of Ttp I randomly shuffle a list read from file and assign it to the object. public class Ttp { private ...
0
votes
1answer
50 views

ArrayList of ArrayList of Integers

I have an ArrayList of ArrayLists of Integers. [ArrayList > list]. How do I set value foe an index of any inner ArrayList? I do not want to build an ArrayList of Integers and add them to the List of ...

http://mssss.yulina-kosm.ru