Questions tagged as 'java'

2
answers

How do I make a regex capture a large variation of a term? (House House)

It is as follows: since I have a term that I want to capture, for example, "HOUSE", how to make a regex so that many variations of that word can be captured,    Home, CASa, CAsa, house, CaSA, CasA ... I know there are    (Home | CASa...
asked by 26.12.2016 / 20:07
2
answers

Fill Map without duplicate records

I have List of an object A . In this object, I have 2 attributes: Long and a BigDecimal . How can I create a Map where the key will be Long and the value will be BigDecimal , using lambda ?...
asked by 31.07.2018 / 20:23
1
answer

Check if ArrayList has equal items

I have class Pessoa : String Nome, Cidade; public Pessoa(String Nome, String Cidade){ this.Nome = Nome; this.Cidade = Cidade; } public String getNome() { return Nome; } public String getCidade() { return Cidade; }...
asked by 30.08.2018 / 00:50
2
answers

Tabuada calculation in Java, using repetition loops

I can not resolve the following exercise:    Display the results of a number table. You enter the value you want. The table should be run from 0 to 10, using the looping technique with logical testing at the end of the looping. I can only...
asked by 27.04.2018 / 16:47
2
answers

Call method by class or instance?

What would be the most correct way to call a method from another class? It is more correct to create the object: private MinhaClasse minhaclasse; minhaclasse = new MinhaClasse(); Then call a method: minhaclasse.meumetodo(); Or just...
asked by 31.03.2018 / 00:39
2
answers

SQL query with error in Java [closed]

I am trying to make a webapp in java, but I am a beginner, in the part of login of the app, I created a routine that receives as parameter an object and performs a search in the database according to the object that contains login = otavio e pas...
asked by 14.11.2014 / 01:20
4
answers

Get the contents of the last line of a file in Java

I need to retrieve from a file always the last line written. I know one way to do this would be: import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.LineNumberReader; public class LineReader { public static voi...
asked by 08.10.2017 / 19:12
2
answers

Loop counter is not increasing

I'm having a hard time finding the error in a logic that I use for to traverse an arraylist. List<Caneta> canetas = new ArrayList<>(); canetas.add(c1); canetas.add(c2); System.out.print(Arrays.toString(canetas.toArray()))...
asked by 26.09.2017 / 21:31
1
answer

java.lang.IndexOutOfBoundsException: Invalid index 4, size is 4

I'm not sure what's happening, when I give a long click on an item in the list, sometimes it works normally (opens a screen that shows the user the information registered, allowing it to change it), sometimes the app to and close and sometimes t...
asked by 03.10.2017 / 16:17
2
answers

Button to display and / or hide keyboard

A% num numeric% will receive input via external keyboard, then display the default keyboard, it should be optional. How do I: When you click on EditText to position the cursor, the keyboard does not open? Open / close the keybo...
asked by 12.04.2018 / 18:02