Questions tagged as 'java'

1
answer

Libraries for communication between Arduino and Android

I am a beginner Arduino programmer trying to make a connection with my cell phone (Android) and / or my laptop using Java. I did some research and so far I've found three examples of how this might work: Using rxtx libraries (GNU IO) Us...
asked by 18.05.2014 / 15:18
1
answer

Code to calculate 2nd degree equation returns "NaN" as roots

I tried to create a program that calculates the two roots of a second-degree equation. When I execute my code, it asks for the values of a , b and c correctly, but at the time of displaying the result, it always returns "NaN"...
asked by 10.11.2016 / 23:23
2
answers

How do I check if two strings are anagrams of one another?

I need to buy two strings and check if the second is an anagram of the first. I thought about using FOR loop repetition. I think you should first check if they both have the same size, then go through them and check if each letter of the first o...
asked by 29.11.2014 / 02:52
2
answers

Is there any difference between the visibility of a View.GONE view or false?

I would like to know which of these implementations is correct? tlb.setVisibility(View.GONE); or tlb.setVisibility(false); What's the difference between them?     
asked by 23.01.2017 / 14:09
2
answers

How to get all the paths of a JTree?

How can I get all the paths of a JTree including the nodes that have parents other than root? root exemplo1 exemplo1.1 exemplo2 exemplo2.1 If I do something like this: for(int i = 0; i< tree.getRowCount(); i++){...
asked by 18.12.2014 / 14:52
2
answers

How to compare the value of a HashMapchave, value with a variable?

I have a HashMap aluno<Integer, Float> , where the key Integer will be the student's enrollment number, and the Float value will be the student's grade. I got the grades average using Iterator , but now I need...
asked by 20.11.2014 / 15:58
2
answers

EntityManager or Session? Which one to use?

I have worked with projects that used both Session and EntityManager but it has never been clear which one to choose. What to base myself on and what they differ in terms of performance and compatibility. Can anyone give a tip?     
asked by 29.12.2016 / 14:17
1
answer

What is the Java equivalent of this lambda in Ruby?

In your Inversion of Control text, Fowler uses as an example a Ruby code snippet that promotes that principle to invoke a bind method on the input field of text that passes an event name and a lambda as argument.Whenever the text input box det...
asked by 12.06.2018 / 02:52
1
answer

SonarLint x Java GC, cancel or not object at the end of execution?

I'm passing SonarLint on a somewhat old application and fixing several "problems", but I came across a code snippet like: public void fazerAlgo(final String param) { MeuObjeto m = new MeuObjeto(); m.setVar(param.toLowerCase()); m...
asked by 25.07.2018 / 13:14
1
answer

Arraylist of int [] in java

I am creating a list from a array using the Arrays.asList method. Now I want to remove the first element, but Java accuses:    Exception in thread "main" java.lang.UnsupportedOperationException List<Integer> lista =...
asked by 17.07.2017 / 22:22