Questions tagged as 'java'

4
answers

Advantage and disadvantage between onClick and setOnClickListener

I have a certain situation where we see that it is possible to create in the XML file a property called onClick : onClick: XML: <Button android:layout_height="@dimen/edittext_min_height" android:layout_alignParentLeft="true" and...
asked by 26.10.2016 / 14:09
2
answers

Import multiple classes from the same package

I wonder if there is any significant difference in doing import java.util.* instead of import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.logging.Level; import java.util...
asked by 08.02.2017 / 13:04
2
answers

What is the difference between wait () and sleep ()?

The meaning of the two words seems very similar. What is the difference between wait() and sleep() ? When to use each?     
asked by 24.12.2016 / 03:54
3
answers

Is it better to have an exception type for each case or a more general exception?

A project from my college was asked to create a class called RepositorioException which is a subclass of Exception to be used for handling exceptions in repository classes, which are: RepositorioMotorista , RepositorioViag...
asked by 09.11.2016 / 20:58
2
answers

How to make 3 SelectOneMenu nested?

I'm creating a page that has to have 3 SelectOneMenu of primefaces. In the first one I will load a center (of the university), the second will carry a edital and the third would load the disciplines of this edital. The first SelectO...
asked by 07.07.2015 / 05:05
1
answer

Implementing a loop with Java functional programming

private List<String> getPermissoes(TipoUsuario tipoUsuario) { List<String> permissoes = new ArrayList(); for (Permissao permissao : tipoUsuario.getPermissoes()) { permissoes.add(permissao.getNome()); }...
asked by 09.07.2018 / 20:57
2
answers

Are there altematives for complex conditions in a lambda expression?

With lambda expressions it is possible to filter elements of a collection of objects by creating a stream of data according to the criteria passed in the expression for the filter() method, this guarantees you a way to manipulate the col...
asked by 29.02.2016 / 04:54
2
answers

How to convert byte to boolean [8] and convert back?

I need to burn some booleans into a file, and then retrieve them. I can write and read one or more bytes with Classes java.io.FileInputStream and java.io.FileOutputStream , so I need to convert 1 byte to an array of 8 booleans,...
asked by 01.07.2017 / 22:15
1
answer

When using Interfaces

I always had the following question: When should I really use an interface rather than inheritance and what advantages can I get?     
asked by 08.05.2015 / 06:25
1
answer

Android - What's the difference between String and Editable?

When making use of the EditText view, I saw that it returns an Editable data type and not a String. And it has different methods like getEditableText() . What is the main difference between String and this other data type Editable ? I...
asked by 24.02.2018 / 18:49