Questions tagged as 'java-8'

1
answer

How to use Optional.ofNullable () in this example?

In this example, how can I use this feature to prevent NullPointerException in get ? public Pessoa parse() { Pessoa pessoa = new Pessoa(); RespostaPessoaEncontrada pessoaEncontrada = ObjectMapperFactory.getInstance()...
asked by 01.11.2017 / 12:24
1
answer

JSF error: javax.el.PropertyNotWritableException

I have an error that I can not solve and I do not know the reason for the following error and my classes and view below. type Exception report messageInternal Server Error descriptionThe server encountered an internal error that prevented it...
asked by 30.11.2017 / 21:19
1
answer

How to create a "new file" .txt in java?

My questions are: is this code correct? how do I clear the screen and open the new created file? menuNovo.setOnAction((ActionEvent e) -> { Stage janela = (Stage) areaTexto.getScene().getWindow(); String nome = JOptio...
asked by 02.07.2017 / 22:53
1
answer

Implementation using API-Streams and API-Lambda Java 8

Good People. Trying unsuccessfully to resolve a proposed exercise using the new functionality of the Java Streams and Lambda 8 APIs. In this exercise, you can only create and change signature methods in the Shopping Cart class. The idea is to...
asked by 09.05.2017 / 20:10
1
answer

Error in code for popular JList with file names of a folder

I can not pass a method to get the name of the files in a folder. I have the following code: inicializar.addWindowListener(new WindowListener(){ @Override public void windowOpened(WindowEvent arg0){ DefaultListMod...
asked by 29.06.2016 / 07:18
1
answer

Filter using stream with class lists that contain lists of other classes

I have the following class structure public class Linha implements Serializable { private static final long serialVersionUID = 1L; private Long id; private String prefixo; private String nome; private LocalDate dataInicio;...
asked by 12.04.2016 / 16:55
1
answer

Chess effect on an image using JavaFX

I'm creating a function using JavaFX so that it uses two images and the size of the pixels and returns a third image containing a chess effect from the other two images. Below is the code, public Image xadrez(Image img1, Image img2, int tam...
asked by 09.04.2016 / 22:18
1
answer

SOLUTION for JAVA 8 error - windows 8

I have a problem running a program that requires JAVA. Before it ran with JAVA 7 and now it is asking for JAVA 8. I did what was requested, however, the following appeared the following error: Application Error    Class Not Found Exception...
asked by 24.04.2015 / 18:56
1
answer

How do I pass a lambda function as a parameter?

I'm doing a college job where I have to develop a calculator with Java. I'm trying to figure out how to pass lambda functions as a parameter so that it's possible to put these functions into a list, so the calculator would have several options t...
asked by 12.10.2018 / 04:59
0
answers

Optimize code with prime numbers

I have the following problem: I need a program that receives a positive even number from the input and forms a "wheel" with these numbers, so that: All numbers from 1 to n are used in the circle only once. The sum of two consecutive number...
asked by 17.09.2018 / 13:26