Questions tagged as 'arraylist'

3
answers

How to set the equality comparison between two objects present in an ArrayList?

How can I set the equality comparison behavior between two objects whose class is defined by me that are stored in an object of type ArrayList? ColorName public class NomeCor { private String nome; public String obterNome() { return no...
asked by 03.04.2017 / 02:55
3
answers

Is it possible to place objects in an ArrayList as soon as it is instantiated?

Doubt applies not only to ArrayList , but to any type of List . Is it possible to add objects to ArrayList soon after we instantiate it, and without having to use the add() method? How can this be done with arrays ?...
asked by 05.01.2018 / 01:16
2
answers

Retrieve the first elements of an Integer list

I have a list ArrayList<Integer> list = new ArrayList<Integer>(); where I have over 40,000 records. I wonder if you have a way to get only the top 10,000. I know you have to for and move to a new list, but this requires...
asked by 16.02.2016 / 17:59
4
answers

Print arraylist information on the screen

I have ArrayList but I can not print the data on the screen. Follow class: public class Cachorro { private String Raca; private String cor; private String nome; private String nome_dono; private int idade;...
asked by 09.12.2016 / 19:15
3
answers

Search for tuple in an array

I have the following vectors: a = [('FI', 'SE'), ('SE', 'DK'), ('DK', 'DE'), ('DE', 'PL'), ('PL', 'BY')] b = [['NL', 'DK', 0], ['NL', 'DE', 0], ['NL', 'BE', 0], ['FI', 'SE', 0.054]] I need to go through the a vector and find it in the ve...
asked by 02.05.2018 / 20:00
1
answer

Difference hashmap and arraylist

Could anyone explain the difference between HashMap and ArrayList ?     
asked by 05.06.2017 / 20:30
1
answer

Converting String in ArrayList

I am getting in my java code a variable with the following value String arquivo = "CNPJ;INSCRICAOESTADUAL;COD_IBGE;DT_OPE;VLR_CARTAO_CRED;VLR_CARTAO_DEB 35083840049;0;4312476;13/01/2018;0.00;66.00 35083840049;0;4312476;18/01/2018;33.00;26.00 3...
asked by 24.05.2018 / 19:53
1
answer

Passing of several parameters as an Array

I have a method that receives an unknown amount of parameters as an Array, like this: public void enviarCampos(String funcao, String... campos) { // Ação do método } To call this method I do: enviarCampos("CADASTRAR", "nome", "dataNasci...
asked by 18.11.2016 / 15:06
1
answer

How to extract JSON Array into an object's List attribute of an object

I'm using the Flickr API to get the information from the images, which returns the following JSON:   per page ": 100," total ":" 5964 "," photo ": [" id ":" 21577339501 "," owner ":" 85277110 @ N02 "," secret ":" 31e850dfeb "," server ":" 578...
asked by 12.10.2015 / 01:32
1
answer

"illegal start of expression" when compiling in CMD [closed]

I have the mini program, which I'll show below. When compiling at the command prompt, I got an error on line 47 and it says:    illegal start of expression I have in the program a list of entries of the size defined in ListaArray ....
asked by 21.09.2016 / 10:34