Questions tagged as 'java'

2
answers

Using hashcode as id is a good practice?

I have a short list of strings (where strings will never be repeated) and would like to use hashcode as id is it a good practice?     
asked by 11.02.2016 / 22:45
1
answer

What is the difference between annotation in method and annotation in attribute

Now, I've started to learn and use hibernate recently, and when looking for answers to my questions regarding annotations I've come across the following occasions: 1st) The attribute has the annotation @Column private String descrica...
asked by 23.07.2015 / 15:58
1
answer

Problem putting multiple data in a list in a report

Good morning guys, this is a somewhat complicated issue to explain, so I'll do my best to make the question clear. I have a <UnimedLote> list. In this list I have several data, among these data there are some that I want to list more t...
asked by 19.05.2015 / 14:42
2
answers

Doubt how to configure Spring Data with Hibernate

How to configure Spring Data + hibernate Hello everyone, I'm new here in stackoverflow and also in developing java Web. I'm learning some Spring Frame stuff and am wondering how I can set up Spring Data in my Dynamic Project. Below is...
asked by 24.08.2014 / 16:42
3
answers

Count elements in an ArrayList in Java

I have Arraylist called tracklist within class Album , which contains a number of songs. I need to loop through and return how many songs I have inside the album through a class I named contarMusica . For now I've done...
asked by 21.04.2014 / 19:08
1
answer

Encrypt a phrase / word by reversing and changing the vowels, by the following vowels

I was given an exercise in which I have to write a program that reads a word in the range [1-20] and encrypts this word using the steps: Reverse the word where you have a vowel, replace with the next vowel And display the word encrypted...
asked by 30.05.2016 / 00:58
1
answer

How to compare relative execution time of fast algorithms?

@Sack asked the following performance questions: What is the most performative way to convert an int to the sum of your digits? What is the most performative way to convert int [] to int? So far, he has got two answers to the first...
asked by 27.11.2017 / 13:35
1
answer

How to compile a Java 9 project with Lombok in Gradle?

TL; DR    How to pass multiple parameters -J--add-opens=<pacote>=ALL-UNNAMED so that Gradle uses them when invoking javac ? Details I have a HelloWorld.java code using Lombok in Java 9: import lombok.NonNull;...
asked by 14.11.2017 / 16:36
1
answer

How to generate JLabel or JTextField on mouse click?

I would like to know if there is a way to generate a JLabel or JTextField in the position where you click, in JPanel or JFrame . Is it possible?     
asked by 19.02.2014 / 17:51
1
answer

Java Code Ponto2D, does not display distance correctly

package OrientacaoObjetos; public class Ponto2D { //campos publicos: nao existem restricoes p/ valores de x e y public double x, y; //constr. default: ponto definido na origem(0, 0) public Ponto2D() { x = 0; y = 0; }...
asked by 25.07.2015 / 00:22