Questions tagged as 'arraylist'

2
answers

How to do every time you pass "true", does it print the entire instantiated object?

import java.util.ArrayList; public class Loja { private ArrayList<Produto> ListaDeProdutos = new ArrayList<>(); /* private ArrayList<Livro> ListaDeLivros = new ArrayList<>(); private ArrayList<Disco> Li...
asked by 14.09.2018 / 14:48
2
answers

Problems deleting repeated numbers in an ArrayListString

I'm having trouble extracting repeated numbers from a ArrayList , here's the snippet of code: for( int i = 0 ; i < houses.size(); i++ ) { for( int j = 1; j < houses.size(); j++ ) { if(houses.get(i).equals(houses.get(j...
asked by 29.01.2016 / 19:51
4
answers

Index returning -1 in Java ArrayList

Good morning. For study purposes, I am making a simple application in RMI Java that simulates some operations (create account, check balance, debit etc ...) in one, or more, accounts. For each account created I generate an object of type Cont...
asked by 22.11.2016 / 12:38
3
answers

Find the element with the largest number

I am making a basic election system, but I have a problem in telling which candidate was elected. In the case, I added three candidates (x, y, z) in ArrayList , put two votes in the x, three in the y and four in the z. When I want to know...
asked by 03.06.2017 / 02:33
2
answers

Is it possible to store an ArrayList in a Java Database?

Given Banco de Dados using Java , can you store a ArrayList object in Banco de Dados MySql ? If yes, how can I store this type of data? And how can I retrieve it from the database? If possible, could you show a simpl...
asked by 02.03.2016 / 02:44
3
answers

ArrayList for String with split [closed]

I'm trying to break the following ArrayList with a String : ArrayList<Funcionario> funcionarios = new ArrayList(); But when I instantiate the object, I add the values in there through my method and I try to use split...
asked by 21.11.2015 / 14:35
1
answer

Create generic type in ArrayList to persist data

I'm having difficulty understanding the concept of Dao and how I could create a specific type to store my data, I'm initially using an ArrayList of Strings and need to adapt it to an ArrayList of Object Product, which would have, for example cod...
asked by 16.03.2016 / 13:01
2
answers

My arraylist is returning the same value on all "nodes"

This code should take all the elements of a login.txt file and place it inside a user array. public ArrayList<User> takeAll(){ ArrayList<User> list = new ArrayList(); User u = new User(); String result = ""...
asked by 05.09.2018 / 01:19
2
answers

Find an object inside an ArrayList

I created a Conta class and set its attributes. In another part of the code, I have defined values for your attributes and added it to a ArrayList , now I need to select it and start the value of one of its attributes, but I am not...
asked by 23.03.2017 / 02:12
2
answers

Sort a List in java that contains null values

Good morning! In my List , when I do the sort order I would like the null values to last. I'll show you an example to get clearer: Code output (in this case the word would be the letter after the number): SEM ORDENAÇÃO: 10c 2...
asked by 24.01.2018 / 14:20