Most voted "arraylist" questions
The Arraylist class is an implementation of the List interface that uses an array to store elements.
Learn more…257 questions
Sort by count of
-
2
votes1
answer1331
viewsHow to order a list in alphabetical order?
I own a List<ListaUsuarios> and I want to sort it alphabetically by name My code is like this User class: public class Usuario{ private String nome; private String empresa; private int idade;…
-
2
votes1
answer346
viewsLoad list from txt in c#
I have the following problem, I get the data from a txt that I need to return in the form of List<List<string>>, but I can only catch from the txt one string [] linha, so I was adding…
-
2
votes2
answers1166
viewsSearching an Arraylist in Java
I’m trying to do a search using the .contains(); of ArrayList, but I can’t return. It’s option 3 public class Fruteira { public static void main(String[] args) { Scanner input = new…
-
2
votes2
answers458
viewsSort a java List containing null values
Good morning! In my List, when I do the ordering I would like the null values to be last. I’ll show you an example to make it clear: Code output (in this case the word would be the letter after the…
java list arraylist comparison collectionasked 6 years, 10 months ago Carlos Rafael de Oliveira Carn 50 -
2
votes2
answers1089
viewsHow to put information in the attributes of an object using Arraylist?
I created a Class Cliente with attributes name, age, address,Cpf. And in the main class I went to do a ArrayList of the kind Cliente, thus ArrayList Cliente<String> = new ArrayList<>();…
-
2
votes1
answer58
viewsJSON for PHP + MYSQL
My client sent me this JSON so that I loop and record the data in Mysql. Only I’m not getting it because it’s different than what I usually do; Someone can give me some hint and what is the…
-
2
votes2
answers648
viewshow to access the class array with jQuery? Take the second class of an element
I’m listing the icons from a list on console.log() they are displayed, however I want to capture only the second classes of icons in a variable, but I don’t know how to access with jQuery the second…
-
2
votes2
answers77
viewsArray is not showing the data that should be there
Class Interface: switch(opcao) { case 1: Usuario umUsuario = new Usuario(); umUsuario.criarUsuario(); break; case 2 : System.out.println("Busca de usuario"); System.out.println("Forneça o cpf do…
-
2
votes1
answer2094
viewsCreating product registration using arraylist
I would like to create a product registration program using the ArrayList. How I put a loop to read NOME, MODELO, TAMANHO and PREÇO and store this first loop at an array list location? What code I…
-
2
votes2
answers56
viewsAdd element to an Arraylist only if it does not exist (Android)
I am programming a bluetooth app in Android Studio. I have an arrayList and I place devices that have been discovered in a bluetooth connection. It turns out that when I perform the task of…
-
2
votes3
answers105
viewsHow to access item in Arraylist
I created a ArrayList for a purchasing system each object is a Item(product), which has the nome, quantidade and preço. However I am willing to make the sum of all prices of all objects that are…
-
2
votes1
answer63
viewsHow can I extract multiple objects from within an Array
I got a problem, I got a problem Array that returns me another Array with this group of objects inside: let array = [ {description: "Auto", amount: 15000, date: "17/02/2021"}, {description: "Auto…
-
1
votes1
answer128
viewsComparing textView to txt using Android arrayList
I’m putting together a very simplistic project in which I show the processes that are running on android and compare it to a list in a txt file that has other processes. The intention is to check if…
-
1
votes2
answers1616
viewsLocating Object in a List
I have the following objects public class Passo { private Long id; private Date dataAtend; private Time horaRealizada; private Long idProfissionalRealizador; private String Descricao; /*getter &…
-
1
votes0
answers543
viewsListing BD data using SELECT and ORDER BY
Doubt There is a screen with an Edittext and a Button. When entering any information in Edittext and selecting the Button the system should redirect the information from Edittext to an Activity and…
-
1
votes1
answer821
viewsHow to modify an object attribute in an Arraylist?
I created a ArrayList(objetoQueCriei), and would like while running the program to change the value of the attributes of these objects in the array. Have some command to do this? I tried to use the…
-
1
votes2
answers383
viewsHow do I manipulate the order of the files in an Arraylist?
I am developing a program, in which part of the processes requires me to take the numbering of the last file listed within a ArrayList. My doubt is this, when mine ArrayList starts adding the files…
-
1
votes2
answers167
viewsData does not persist in txt file
Good morning, I’m having a question, I have this code, which is a contact book and the data should be persisted in a txt file. What happens is that the program runs normally, but the data is not…
-
1
votes1
answer393
viewsHow can I move an element from an Arraylist to the last element ?
I would like to know if there is any method to perform the operation, other than to concatenate manually. Example of what you wanted: [1,2,3,4] -> [1,3,4,2]
-
1
votes2
answers4092
viewsHow to convert a list to string and vice versa?
I have a list: ('47075', 'josenestle', 'i need help') I do str1 = str(list) and have it in string. However if you do list(str1) I do not recover my list. I find no obvious solution, help would be…
-
1
votes0
answers31
viewsHow do I access a pdf file stored in R.raw on android SDK?
I think some information is missing to make the pdf file appear in my app. I used the following line of code within the Oncreate method: PDFView novo = (PDFView)findViewById(R.id.pdfView);…
-
1
votes1
answer497
viewsI can’t register a Java Arraylist
I’m making a Java (console) application. It’s time to register a arraylist She goes, but when it’s time to show, she shows me trash. What do I do? Follow the code: Main class: //classe main import…
-
1
votes1
answer203
viewsJava arralist does not return data
My doubt consists in the following problem. I am building an application (didactic purposes). It has a Contact class that receives a String with name, a String with the phone, and the constructor…
-
1
votes0
answers81
viewsHow to get into Arraylist on a JSP and pass as parameter p/ a Servlet (Link)
This list has the Id_book,Titulolivro,Autorlivro, which is displayed on the page correctly. Only I want to create a link to a Servlet passing the Id_book. How do I do it? Below is the code:…
-
1
votes1
answer2439
viewsHow to reference an arrayList of another class
Personal my code is still unfinished and I am creating a library system as college work want to do as a reference to use a list array of another class in a new class. I want to use the same Book…
-
1
votes1
answer136
viewsIs it possible to convert an Arraylist<Double> to Arraylist<Integer>?
So, guys, I’d like to know if there is and how to make the conversion of a ArrayList<Double> in a ArrayList<Integer>?
-
1
votes0
answers95
viewsHow to return BD Json text to Arraylist in Java
I am having problems converting a set of texts in the Json format of the database to a set of Arraylist texts in Java. Follow the code below: Java model. public class Sala { private String…
-
1
votes1
answer404
viewsShow user-installed apps only
Good friends, I’m developing an app for the user to share, back up .. from third-party apps. Be able to create a list where shows all the app’s. It turns out that I do not want to appear system…
-
1
votes3
answers1407
viewsHow to transform an Object Array into a Simple Array? Javascript
I wanted to know how I can transform an Object Array to a Simple Array with only a certain vaor.. I have this: const names = [ {id:0, name:"Jean"}, {id:2, name:"Ricardo"}, {id:4, name:"Letiiicia"},…
-
1
votes1
answer247
viewsI add items to Arraylist but when I use it it is empty
I cannot add items to my Arraylist Main class, where the array is instantiated public class act_principal extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{…
-
1
votes1
answer1315
viewsTransform object into array keeping the index
Good afternoon Friends who can help me? I have this Object Array, I needed to turn this Object into a list more keeping the Input as it is Using Map it changes the Dice: I needed then to access each…
-
1
votes1
answer173
viewsWhy can’t I access the elements inside an Arraylist with a for?
I’m trying to fill a jtable with elements that are inside an arraylist, which is inside another object: private void jButtonConfirmarProdutoActionPerformed(java.awt.event.ActionEvent evt) {…
-
1
votes1
answer33
viewsScroll through a list to get the current element and the next
How can I implement two for(Teste teste : lista) {} to go through the same list? And the second foreach would always have to look at the next item on this list? I tried that way but he always…
-
1
votes1
answer457
viewsError trying to use Arraylist methods (symbol not recognized)
I just can’t use any method of the Arraylist class (always gives compilation error) and I have no idea why. Am I making some syntax error? I didn’t get any answers searching the internet. I put…
-
1
votes1
answer763
viewsJSON doesn’t convert special character?
I have a ArrayList and when will I convert him to a Json using the Gson special characters do not accompany serialization. Obs My bank and project is in encoding utf8. I am Serializing the ArrayList…
-
1
votes2
answers407
viewsHow to Store Splitted Strings in an Arraylist?
I’m doing a job where I need to save the information from a current account, I need to read the information from a file (text) and split this information into account code, name and balance. Also, I…
-
1
votes2
answers509
viewsHow to view object information from my Arraylist?
I want to create a ArrayList to store information about students (name, number and status) but I’m not getting Arraylistadicione the information. The code I have is this:: Java class. package turma;…
-
1
votes1
answer1217
viewsinsert data from an array into the database - java
I am creating a system that at a certain point should create an order and this request has several items that I put inside an arrayList. I have an order table in the database, in which way I will…
-
1
votes2
answers1709
viewsWrite and print data in an Arraylist
I am doing a college job and I need to save in an arrayList the name and age of 10 people and then print the data of the person who is at position 7, but when I print returns null. I do not know if…
-
1
votes1
answer67
viewsItem Selected in Spinner does not appear in Toast
When clicking on the item in Spinner, Toast is not called, nothing appears. public class RegistrarActivity extends AppCompatActivity { private ImageView botaoVoltar; private EditText textoCPF,…
-
1
votes1
answer750
viewsMethod Returning Empty List
I am having a problem with a java method. The intention is to split a Hashmap into pages, and return an Arraylist with each page. Code: public static ArrayList<HashMap<String, Key>>…
-
1
votes2
answers322
viewsDoubt about how to iterate on an Arraylist
I have this exercise below to do put in question "D" I’m struggling , if someone can explain me how I should do : a) Create an interface called ModeloContato with the methods getNome(),…
-
1
votes1
answer880
viewsHow to filter values by keyword in the array?
The codes below are not working very well the way I want: $array = array('January', 'February', 'March', 'April', 'May', 'June'); function filterDataByValue(array $array, $value) { $filtered =…
-
1
votes4
answers482
viewsComparing Strings using Arraylist
I need that in the repetition it identifies the same strings, I know that I need to use the . equals(), however, is giving error, as if the variable x is checking more value that exist in Arraylist,…
-
1
votes2
answers117
views"java.lang.Outofmemoryerror" error with List
I have the following statement of the problem: A method that takes an integer as a parameter and returns a list of integers with their decomposed prime factors. As an example, if the input is number…
-
1
votes2
answers1829
viewsHow to find a String inside an Arraylist
I have difficulties in using the Arraylist class, more specifically in the search for a String. The point is, my code even works, but when I register more than two books inside Arraylist, at the…
-
1
votes1
answer1585
viewsAlphabetically Sort an Arraylist
I have an Arraylist called Test with the fields: public class Teste { private String dctitle; private String rdfabout; private String dbid; private String depto; private String sigla; private String…
-
1
votes1
answer651
viewsHow to compile a list with data from an Observable?
How to go through data from an Observable and insert into a list? I would like to compile a list of all the arrays within Observable that comes from Cloud Firestore, because I need a list of people…
-
1
votes1
answer1495
viewsRemove() method does not remove Arraylist object
I’m having a doubt to remove an object from a list on a job. I have a car class: public class Automovel { String marca; String modelo; String preco; Automovel(String marca, String modelo, String…
-
1
votes1
answer122
viewsHow to have an Arraylist by composition
I understand how to compose but I’ve never done with lists, although the principle should be the same, I don’t understand how to do. For starters I have a class CentroComercial who owns a ArrayList…