Questions tagged as 'arraylist'

4
answers

Comparing Strings using ArrayList [closed]

I need to repeat the same string, I know that I need to use .equals (), but it is giving error, as if the variable x was checking more value than exists in the ArrayList, but has as condition that x is smaller that the "data.size ()" (which is t...
asked by 29.08.2017 / 18:29
2
answers

Reading rows from a TXT to ArrayList

I need to read a log recorded in a TXT file that contains geographic coordinates in the following form: -54.123440,-21.123456 -54.123425,-21.123467 -54.123435,-21.123480 -54.123444,-21.123444 -54.123452,-21.123100 Each line has the longitud...
asked by 18.05.2018 / 21:23
2
answers

Error "java.lang.OutOfMemoryError" with List

I have the following problem statement:    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 entry is number 36, the method returns a list containing [2, 2,...
asked by 03.09.2017 / 03:24
2
answers

Doubts about how to iterate over an ArrayList

I have this exercise below to do in the question "D" I am having difficulties, if someone can explain to me how I should do:    a) Create an interface called ModeloContato with methods getNome() , getTelefone() and ge...
asked by 20.08.2017 / 19:30
1
answer

I can not register an ArrayList in Java

I'm doing a Java application (console). At the time of registering an arraylist even goes, but at the time of showing, it shows me trash. What do I do? Here is the code: Main class main: //classe main import java.util.Scanner; publ...
asked by 21.04.2016 / 21:05
1
answer

List getResults returns list with elements equal

Hello. I have the following table in mysql: create table resultado( data varchar(10), premio varchar(3), loteria varchar(5), milhar varchar(10), primary key(data, premio, loteria) ); The class representing this table in Java: public cl...
asked by 22.10.2018 / 04:28
1
answer

How to modify an attribute of an object in an ArrayList?

I created a ArrayList(objetoQueCriei) , and I would like during program execution to change the value of the attributes of those objects in the array. Do you have any commands to do this? I tried to use the set command, but would...
asked by 22.10.2016 / 01:50
2
answers

Finding 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 & Sett...
asked by 10.11.2015 / 18:41
2
answers

Array 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 usuario");...
asked by 09.11.2018 / 19:38
1
answer

How to have an ArrayList by composition

I understand how to do composition but I have never done with lists, although the principle should be the same, I do not understand how to do it. To start I have a class CentroComercial that has a ArrayList called lojas w...
asked by 15.04.2018 / 16:47