Questions tagged as 'java'

2
answers

Is it possible to reuse a Thread?

A Thread dies when its run () method ends. My question is: Does the thread die mean that the Thread object becomes null? Is it possible to reuse a thread?     
asked by 21.11.2018 / 21:31
2
answers

Remove brackets from an arraylist

I'm starting in this Java and I have a problem. I make a query in mysql and I save the data in an ArrayList, of which I only need the data, without the brackets that appear at the beginning and end. Could someone help me by telling me how to r...
asked by 21.06.2017 / 18:54
2
answers

The result set has no current row

I'm doing a program of Libros and Autores where a autor has many libros . When inserting a new Libro I need to get id of autor to save it as fk_dni in table Libros , so I have...
asked by 30.08.2017 / 20:12
2
answers

Delete all the elements of a treeMap

I would like to know how to remove all the elements of a list treeMap of Java. I have the following method that removes only one element: public boolean eliminarProducte(String codi){ return map_catalogo.remove(codi)!=null; }     
asked by 11.01.2017 / 23:13
2
answers

Exit a loop when it finds a Java environment

I have the following function that searches the entire list and when it finds the occurrence, it returns it at the end. private static int getIndexRouteInListByRef(List<Route> mArray, String search) { int outIndex = -1; for (int...
asked by 11.12.2016 / 14:18
2
answers

How can I play an Android TextToSpeech on the main speaker (where you hear calls) on the device?

I play the following code but it plays through the stereo speaker of the device: private TextToSpeech textToSpeech = new TextToSpeech(this,this); textToSpeech.setLanguage(new Locale("spa","ESP")); speak("Hola mundo" ); private void speak(Str...
asked by 11.05.2016 / 13:46
1
answer

how to use an existing class in java from grails?

I have a class in java that I intend to use from grails, what is the best way to do it?     
asked by 08.05.2016 / 18:17
4
answers

Is there an equivalent of C ++ using namespace for Java?

Well, my question is very simple. In C ++ I do this: using namespace std; Then I can use the strings. What I would like to know is, if there is something in Java to import all the functions of a class. Now, what I do is call the functi...
asked by 27.11.2016 / 16:01
1
answer

Add a space between each character

I try to separate the characters of a String by spaces using a regular expression. That is, 111 results 1 1 1 or ABC results A B C and the output should be a string. String nombre = "111"; nombre = nombre.rep...
asked by 25.03.2018 / 16:17
3
answers

Verify that the first letter is a vowel

I am trying to validate with a regular expression that the first letter is a vowel in the following way, but I can not. String pattern = "[aeiouAEIOU]{1}[A-Za-z]"; String buscar = "alphabet"; if (buscar.matches(pattern))...
asked by 02.09.2018 / 13:40