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
-
0
votes3
answers412
viewsHow do I create an Arraylist of objects with each position containing a new object?
public class Produto { String marca; int quant; Produto prod = new Produto(); ArrayList <Produto> lista_de_produtos = new ArrayList<>(); lista_de_produtos.add(new Produto()); //É dessa…
-
0
votes2
answers89
viewsProblems when adding numbers to an Arraylist
My code is like this: public class QuestionarioController implements Initializable { InicioController inicio = new InicioController(); Quiz questionario = new Quiz(); @FXML private Label…
-
0
votes3
answers2541
viewsTaking String values from Arraylist<Object>
I take all my values from the database and put them in one array list<object> i would like to know how to access the value within this arraylist emu, for example TesteLinhas.get(0).toString()…
-
0
votes1
answer22
viewsHow to use Scanner to define the characteristics of the "product" object
public static void cadastrarProduto(String nome, int codigo, int quantidade, double valor) { var produto = new Produto(); Scanner leitor = new Scanner(System.in); nome = leitor.next(); produto.nome…
-
0
votes2
answers536
viewsConcatenation of an arrayList into a listview?
I wonder if there’s a way to add "strings" to be exhibited in a listview so that I don’t have to be imposing conditions and more conditions and set again the "strings" already used: package…
-
0
votes1
answer143
viewsArraylist giving error
I’m doing a little program with a database and I can’t seem to get my list to appear in one jtable. I created the method and at the time I call my method it error, someone can help me code this…
-
0
votes1
answer323
viewsJava Array List: How to show a Jlist the values and Positions of the String Array
I made this code in class: public class Dados { ArrayList<Contato> contatos = new ArrayList(); public void cadastraContato(Contato contato){ contatos.add(contato); } public String…
-
0
votes1
answer69
viewsBuble Sort Arraylist - Java
I need to sort an array based on the Date field of the same, for that I made this code. SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); for(int i = 0; i <…
-
0
votes1
answer1381
viewsHow to print an Arraylist inside a Joptionpane?
Staff would like to know how to print an Arraylist inside a Joptionpane, I leave down the code I am using but not working: import java.util.ArrayList; import javax.swing.JOptionPane; public class…
-
0
votes1
answer912
viewsHow to record a student’s grades using the List array
I need to add notes to certain students (each student has several grades and each grade belongs to a discipline), but as I am using Ist arrayand have little knowledge in java I am well lost in…
-
0
votes1
answer58
viewsRemoving items from a list
The case is as follows, when I remove the data from the list, when the number of the head is greater than the second is all right for example: List<a> 0 - ITEM A 1 - ITEM B (X) Exlui este! 2 -…
-
0
votes2
answers90
viewsProblem Handling a list of Objects in jsp
I’m having trouble handling a list that comes from my controller in my jsp I believe I’m not using the right way to treat and go through this list follows my controller who creates the list.…
-
0
votes1
answer538
viewsView Java Database Values
I’m a beginner in Java and I’m making a mini RPG-style program for Database Testing, and I want to display the data contained in the BD using a ArrayList, but the result of the exhibition is always…
-
0
votes1
answer70
viewsArraylist does not display correctly
I have a super class Person with 2 sub classes (Student and Teacher). However I made another class "List" to create Arraylist and later handle everything. When using the List the data is accepted…
-
0
votes1
answer54
viewsDoubt - Hashmap
I need to go through a list of hotel reservations and, for each such reservation, capture the Event that is associated with it. At the end of the process I need to say how many hotel reservations…
-
0
votes1
answer50
viewsDoubt - Hashmap & List
My need was as follows: A report that would bring the Event and the number of hotel reservations that was associated with that Event. And so it followed as the code below shows:…
-
0
votes0
answers432
viewshow to edit an angular array
Hello I’m new to js and angular and I’m trying to edit an array where I save tasks to be developed. I have the following functions to add and delete the elements, but I can’t think of a way to edit…
-
0
votes2
answers492
viewsString counter in Arraylist
I need the program to return the amount of times each String repeated itself within the ArrayList, but I could not think of a way in which my counter is reused for each item, because as it shows…
-
0
votes1
answer432
viewsArraylist, Collections
I have an exercise list on Arraylist , but only the first question has left me with several doubts : Implement an interface with abstract methods getName, getValor, which should be implemented in…
-
0
votes1
answer659
viewsApply data from a txt to Arraylist
I need tips on how to create (where to start, what functions to use, etc). A generic project that receives a file .txt, read the data and store the words in a ArrayList<>. I’ve already created…
-
0
votes0
answers442
viewsError "Concurrentmodificationexception" when modifying (insert data into) Arraylist
I am trying to create a small login system in Java. I have the following classes: Logincontroller: public static void main(String[] args) { ArrayList<Usuario> listaUsuarios =…
-
0
votes1
answer710
viewsDoubt Exercicio Collections - Queue Interface
I’m having a question in this exercise about Collections in which I should use the Queue interface : Write a program that simulates control of an airfield at an airport. In this program, the user…
-
0
votes3
answers373
viewsArray overriding elements
I did the method registraReclamacao() in that class and every time I call him on main, he overwrites and only stores the last record. package testelp2; import java.text.SimpleDateFormat; import…
-
0
votes1
answer194
viewsHow to implement an arraylist in one condition?
I need this code to have a class Estudante, one Professor and another Disciplina. I’m trying to limit the class students Disciplina in 50 with a ArrayList and a condition, but maybe they’re in the…
-
0
votes1
answer52
viewsAdapt txt file reader
I was using a manual method to grab a txt file, where the user typed the file name and extension and pressed the button, now that replace by a code that opens a search box to choose the file on the…
-
0
votes1
answer84
viewsArray list does not store data
//------------------------------------------ Classe diario (metodo localizar aluno)-------------------------------- package gerenciamento; import java.util.ArrayList; public final class Diario {…
-
0
votes0
answers57
viewsJsonobject does not add Arraylist
I use the code below to popular my arrays quietly, but when researching a topic here, I realized that for my problem I could use a generic class. The problem is that Jsonobject is not populating…
-
0
votes2
answers92
viewsJDBC code fails with exception
I’m trying to perform a database search through java. I am using this code, but this entering the exception: public ArrayList<Pessoas> pesquisar(String nome) { ArrayList<Pessoas> lista =…
-
0
votes1
answer137
viewsRead Arraylist that is serialized
I create and instantiate objects of the student type (abstract class), and add them in the array. After that, the serialization of the same is done. How can I deserialize this array, and print…
-
0
votes1
answer4414
viewsCan not deserialize instance of java.util.Arraylist out of START_OBJECT token
Using angular, I am unable to insert an array of genres into the Genero property that is in the Manga object. Using Postman to insert the Generos array into the /sleeve API would look like this. {…
-
0
votes1
answer50
viewsLoop loop in Listview
Can someone help me? In a listview where the data comes from an internet database I can’t let it be automatic so that all values coming are included, the only way is to add one by one, but when as…
-
0
votes1
answer42
viewsForce the user to type enter
In an excerpt of my code, I need the user to enter to continue the program, however the part where you should receive this entry is ignored. public void buscar_Aluno(){ //metodo que busca um…
-
0
votes1
answer25
viewsCondition on a list
I have a program that inserts information into a CSV file. And I wanted to check if there is data in the variable if it does not show a message that there is no data entered in the file. var csv =…
-
0
votes1
answer95
viewsNull object array - Android Base Adapter
Hello I was making a gallery, I created the Adapter, worked normally, so proceed to the step of listing files in a directory and then put in the list: ArrayList<GalleryItem>items = new…
-
0
votes1
answer30
viewsSpinner Json and Arraylist
I’m starting on Android development and I’m having a tense doubt here. I have to return a Json like this: [ { "codTransportadora":295, "NomeTransportadora":"UTILISSIMO", "codEmpresa":3122 }, {…
-
0
votes2
answers82
viewsWorking with vectors / matrices
Hello, I have the following question, I have 5 vectors string[] Defesa = { "Gigante", "Golem", "Gigante Real" }; string[] AtkTorre = { "Corredor", "Ariete de Batalha", "Gigante Real" }; string[] AP…
-
0
votes2
answers127
viewsConvert class to generic
I need to convert the code class below into a generic implementation using a Arraylist. Can anyone suggest a better way to do this? Code: public class ArrayStack { private int maxsize; Retirar essas…
-
0
votes1
answer392
viewsChecking the existence of an object in an arraylist
I have a class PessoaFisica and a class PessoaJuridica, both inherit from the class Cliente, whose attribute to identify is the code. I am creating a method to check if the element already exists in…
-
0
votes1
answer159
viewsManipulating an object that is present inside an Arraylist
I need to do some operations of combinatorial analysis with information present in objects, but I do not know how to extract them from ArrayList. I need to remove the content present in the variable…
-
0
votes0
answers22
viewsArray splits itself when the elements inside it pass 100 during the api post
I’m trying to post for my api but when the amount of items in my array exceeds 100 it splits up like this: But my api only accepts this array when it gets like this: What I should do for the array…
-
0
votes1
answer41
viewsDisplay only results that satisfy the condition within the loop
I’m building a little algorithm that runs through a ArrayList and compares the value found with a value typed by the user. But I want to print on the screen only the value that satisfies the…
-
0
votes1
answer62
viewsWhen I click on Listview to open another Aciticity the app hangs and Fexa
I’m creating an App that looks for nearby wifi networks and then can connect to them, but locked at the beginning, because I can make it scan, but when I click on some network of the list, which…
android android-studio listview android-activity arraylistasked 6 years, 4 months ago Emanuel Boaventura Matos 9 -
0
votes1
answer140
viewsHow to display objects from a list?
I have the Personal class which has the following method: public List<Pessoa> BuscarTodos() { List<Pessoa> list = null; EntityManager em = getEM(); try { list = em.createQuery("select t…
-
0
votes0
answers42
viewsRegistration N to N (many to many), where I need to send an Array according to the image
I am making a registration N for N (many for many), where I need to send according to the image an Array of medicines, Unit and posology. The question is how to take this Array in just one request…
-
0
votes0
answers199
viewsHow to create a String Array from a String Array and an Integer Arraylist?
I am creating an application that will need to store the specialties of each clinic registered in the application, these specialties later I will be in the database of Firebase, I am using a dialog…
-
0
votes1
answer499
viewsPopulate Arraylist dynamically ANDROID STUDIO
The main screen of my app consists of a few sessions using Recyclerview. For my recyclerview Adapter I pass an arraylist of type Sessoes for the screen to look the way I want. But this arraylist I…
-
0
votes3
answers176
viewsPrint result of an array in php list format
I have two arrays in php, which I compare and create a third and want to print this difference on a list. I’ve tried the foreach, but this method prints a huge list in string. This is my code: $sql…
-
0
votes1
answer311
viewsHow to convert Jsonarray to Arraylist<> on android
Hello, all right? I would like your help to be able to convert a Jsonarray to Arraylist<> on android. I make a request that returns me the following Json: {"normal":{"test_graph":{"VALORES…
-
0
votes0
answers32
viewsDelete chosen file from a list and subtract from the total value - Ionic
I’m developing an app with Ionic 3 and Firebase. I am facing problems, because it is not decreasing the value of the product(chosen) of the total. Always subtract the last value informed. Follows…
-
0
votes1
answer57
viewsListview with Arrayadapter
Hello guys I’m new in Android and I’m with a question of data overwriting in listview that I haven’t been able to find yet. I have a Tabbed with 3 tabs, and when clicking the first time tab the…