Questions tagged as 'java-8'

1
answer

Calculate age by taking a date of type Date

I would like to calculate the age by taking the date of birth from the database, using pojo . I was looking at how to do a date calculation by looking at this question: Calculate age by day, month, and year My date in the database...
asked by 06.08.2017 / 03:18
1
answer

How to check if a given field / value exists in the JSON document?

{ "timestamp":"2018-10-08T16:58:38.949Z", "dataFrame":"QQ==", "fcnt":15, "freq":902500000, "port":12, "rssi":-69, "snr":10, "sf_used":10, "session_id":"f41e10e8-1c73-499c-8ad7-4cbcd54c8ebd", "gtw_info":[{ "gtw_id":"000000000b0319a3", "rss...
asked by 09.10.2018 / 17:49
1
answer

Class does not compile when using the new 'Optional' feature of java 8

Good afternoon I'm using play 2.5.4 with java 8 v01.08.91 And when using some features of java 8 as the class 'Optional' with the 'ifPresent', 'isPresent', or 'get' methods the following error occurs when compiling the java classes "java.la...
asked by 17.06.2016 / 21:03
3
answers

Return amount of days to end of year

How could I do to return the amount of days to the end of the year, relying on today. import java.time.LocalDate; import java.time.Month; import java.time.Period; import java.time.format.DateTimeFormatter; public class TestLocalDate { pu...
asked by 28.08.2016 / 21:26
2
answers

How to force an html document to always be opened by the browser?

I'm developing a java application for a college job and I have a help section for the user where I open a html page in the browser, or at least should open it. The point is that if files with .html extension were by default of t...
asked by 07.07.2015 / 15:18
3
answers

Java 8 (Stream) - Summed group

Good morning. I have the following function below: private List<Object[]> calcularTotal(List<Object[]> lista, int chave, int valor){ return lista.stream() .map(l -> new Object[] {l[chave], l[valor]})...
asked by 19.02.2015 / 14:32
1
answer

Final local variable in inner class in Java 8

There was a change between Java versions 7 and 8. Where in Java 7 for a local variable to be used within a inner class it should be declared final . Now compiling with Java 8, this local variable is no longer required to be declared...
asked by 02.06.2017 / 14:07
1
answer

Foreach with Lambda does not work

I have a list of objects that I want to go through, but it is giving error and I am not understanding why: listaAtendimento.stream().forEach(atendimentoFicha -> { fichaAtend.getAtendimentosIndividuais().add(getAtendIndivC...
asked by 12.11.2015 / 11:32
1
answer

How to tell who a class will extend at runtime?

I have the class public class Conhecimento{} This class extends from another class "CteProc" Only this CteProc class has "versions" example. v200.CteProc v300.CteProc My problem is that in creating the Knowledge class I need to...
asked by 11.09.2017 / 14:45
1
answer

How to save a localdate in a mysql table?

I have a table book that has a column of type "Date" and in my java code I have a field of type "localdate". I need to save the data from the "LocalDate" field in the table however I am finding it difficult to do this, any suggestions? Java:...
asked by 25.06.2017 / 20:52