Most voted "java-8" questions
Java 8 was released in March 2014 and contains new features, enhancements, and bug fixes to increase the efficiency of Java program development and execution.
Learn more…208 questions
Sort by count of
-
1
votes1
answer765
viewsHow to access the value of a private attribute in a Java class without a public method?
How can I access the value of a private attribute in a class, a class in another package, without using an access method, such as a getter? class Person{ private String name = "Someone"; } Why would…
-
1
votes1
answer68
viewsJava does not compile. java
Java does not compile error return, it is not possible to locate or load main class with.sun.tools.javac.Main.
-
1
votes1
answer694
viewsHow to check if a Resultset is empty?
I’m making a query in Mysql and when the query exists it returns the good values. But here’s the question, what’s the value ResultSet receives when the search does not exist? Type look for a name in…
-
1
votes0
answers55
viewsListview with Hibernate 3 no population
I have the class below, the method listGeneroTreeView(), captures the values I have in the bank. However, I am not able to display this data on treeview. I just know it works for a message I put in…
-
1
votes2
answers267
viewsHow to split a number stored in a string and check if it is divisible by 495?
For example a number that doesn’t fit in one int and I store in a String. How do I see if it is divisible by 495?
-
1
votes0
answers39
viewsChange menu text Accelerator
I created the following MenuItem, MenuItem item = new MenuItem("Alterar"); KeyCodeCombination acc = new KeyCodeCombination(KeyCode.ENTER, KeyCombination.CONTROL_DOWN); item.setAccelerator(acc); It…
-
1
votes2
answers138
viewsStream Manipulation(java 8)
Good morning guys I would like to get a little doubt, I have a String Stream with many lines of a txt, I need to do a split to break the lines in the Pipes, but the return as you know is a String…
-
1
votes3
answers181
viewsHow do I use the new Java 8 Date API?
I would like to know how I compile in my Gradle Build to make available the new java 8 date API in my android studio
-
1
votes0
answers40
viewsIs it possible to fill a tree list in reverse using stream?
The point is this My class public class Node{ private String name; private Node parent; private List<Node> children; public Node() { } public Node(String name) { this.name = name; } public…
-
1
votes2
answers685
viewsTomcat does not activate in Spring boot. How do I activate it?
I’m doing a project using Spring boot on Intellij + Maven. Following and reading tutorials. I did the step by step but when taking Run Tom Cat is not shown, activated. I am not using any other…
-
1
votes2
answers755
viewsGeneric DAO with CDI error = cannot be cast to java.lang.reflect.Parameterizedtype
I’m trying to implement a generic CDI DAO. Apparently I’m doing it right, but I’m getting the following error: cannot be cast to java.lang.reflect.Parameterizedtype This error is pointing me to this…
-
1
votes1
answer86
viewsWhy is my String names accepting whole numbers instead of letters?
import java.util.Scanner; public class Tp1 { public static void main (String [] args){ final int qtdAlunos = 5; String [] nomes = new String[qtdAlunos]; double[]…
-
1
votes0
answers1274
views -
1
votes1
answer52
viewsUpdate class fields with sequential names
How to update the background color of 15 JTextField during a loop? For example, I own the following JTextField: txtEsp1 txtEsp2 txtEsp3 ... And I want to create a loop, to set the background of the…
-
1
votes1
answer1662
viewsJSF error: javax.el.Propertynotwritableexception
I have an error that I can not solve and do not know the reason Follow error and my classes and view below. type Exception report messageInternal Server Error descriptionThe server encountered an…
-
1
votes1
answer457
viewsError trying to use Arraylist methods (symbol not recognized)
I just can’t use any method of the Arraylist class (always gives compilation error) and I have no idea why. Am I making some syntax error? I didn’t get any answers searching the internet. I put…
-
1
votes1
answer98
viewsPrinting a 3-in-3 formatted sequence of numbers separated by dash
Let’s say I have the following entry String S = "00-44 48 5555 8361" and that I need to return this character string divided 3 by 3, separated by "-", as follows: Output: 004-448-555-583-61 The…
-
1
votes1
answer124
viewsDifference between using a Stream or Collection
I see that the use of stream Java 8 is recommended for large amount of data. If the data set is small, there is some gain from using only Collection?
-
1
votes1
answer179
viewsChange Dialog is not displaying data
I have a Maven project that is using jsf, jpa and primefaces in which there is a dialog that is being used to do the altualization(update) of the data, only, inputText is empty when it is called…
-
1
votes2
answers250
viewsHow to validate elements produced during a Java Stream before Collect?
Given the hypothetical example below as it would be the best way to validate all the elements produced by a Java Stream, in the example below I would like to check if all the elements produced are…
-
1
votes2
answers587
viewsTurn a for into lambda with variable interaction
How to turn the section below into a Lambda code? The idea is to multiply the maxScore for i so that at each interaction it increases the number, only for the first 5 results. for(int…
-
1
votes2
answers542
viewsHow to convert json to object and put into a system.out.println?
I have the following code that returns a JSON: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import…
-
1
votes1
answer62
viewsI can’t generate that second vector
Write a program that loads a vector with 10 integers and sort it in ascending order using the Bubble Sort method. The program must generate a second vector without repeated numbers. package…
-
1
votes1
answer52
viewsError including name attribute in @Webservice
I am creating the class that implements the WS call and when trying to include the name attribute, this error appears: "@WebService annotation contains an endpointInterface attribute. No name…
-
1
votes1
answer633
viewsGroup List with java 8
The input data would be a list of Products as below [ { "id": "123", "ean": "7898100848355", "title": "Cruzador espacial Nikana - 3000m - sem garantia", "brand": "nikana", "price": 820900.90,…
-
1
votes1
answer68
viewsTransforming Collections into Stream
There would be ways to transform the following code to java 8 Stream? setores = new SetorBusiness().buscarEtiquetaFuncionario(null, codDiretoriaSelecionada, codCoordSelecionada, uf, cidade,…
-
1
votes1
answer78
views -
1
votes1
answer57
viewsTimeout configuration for a single call in Spring Boot
It is possible to set timeout for a single specific Controller class in Spring Boot, how can I do this? Because using the property spring.session.timeout it arrow the timeout for the application as…
-
1
votes1
answer4788
viewsDistance between two points
Read the four values corresponding to the axes x and y of any two points in the plan p1(x1,y1) and p2(x2,y2) and calculate the distance between them, showing 4 decimal places after the comma,…
-
1
votes0
answers21
viewsExternal static methods not being recognized in the project
I am importing a library of utils into my main project, the library currently contains a single static method, I can import both manually and by Maven, but I am not able to access the static method…
-
1
votes0
answers46
viewsHow to go through <c:foreach> and do a search bar from all the data?
I’m trying to put a search bar on the site using javascript, but it only searches the words I insert in the field in the first object added and not at all... My JSP: <ul class="list-group-item…
-
1
votes1
answer1219
viewsString readline() in Java
I’m having difficulty instantiating the readline() method correctly in java so that you read the file, run the while loop and write the desired data. If anyone can help me, I’d really appreciate it!…
-
1
votes3
answers219
viewsGet maximum table value (JPA) with Java 8
I have a method in my DAO class that returns a general list of the table: public List<ObjetoRisco> findAll() { return manager.createQuery("select o from ObjetoRisco o",…
-
1
votes0
answers44
viewsPUT error: All object fields are null
I have a user with id 3, a car with id 6 and I do a POST on the rental passing these 2 id’s, until then ok, the GET returns this { "id": 5, "usuarioCliente": { "id": 3, "nome": "Arthur", "cpf":…
-
1
votes1
answer303
viewsSum of two floats with 2 decimal places resulting in 4 decimal places in JAVA
I am having a JAVA problem where I want to store calculation results with only 2 decimal places in SQL Server. For that at the end of my calculations I perform: Math.round(valor * 100.0f) / 100.0f;…
-
1
votes1
answer97
viewsJdesktoppane does not remove closed screen rendering, how to proceed?
I created a basic screen with Netbeans that has a menu and a JDesktopPane that opens the JInternalFrame menu-referenced: As well as a function to open these JInternalFrame: private void…
-
1
votes1
answer89
viewsFilter files by their extension(xml, rar, docx....)
Good Afternoon, I have an algorithm that takes all the files of an x directory, and reads them, but these files have to be XML, and sometimes RAR files appear, then at the time of reading give error…
-
1
votes1
answer40
viewsCreating matrix with the Scanner class
I’m trying to fill a 5x5 matrix but when I run the ORDER in the finish entry, the code returns me the matrix filled with the word END. public static void main(String[] args) { Scanner sc = new…
-
0
votes1
answer68
viewsJAVA 8 ERROR SOLUTION - 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 asked, however the following error appeared: Error of application…
java-8asked 9 years, 7 months ago Janio Lucio 1 -
0
votes1
answer332
viewsProblem when doing String Code and Discovery
I would like to know why such methods do not behave in a way that: long2str(str2long(String s)) == String s public long[] str2long(String s){ final byte[] authBytes =…
-
0
votes1
answer175
viewsLabel’s and/or Textfields do not appear in subreports in Jasperreports
I have a report with sub-report in jasperreports, the problem is that when I run the report it is not displaying the contents of the Abels or textfields that I put in the sub-report, someone has…
-
0
votes1
answer113
views -
0
votes1
answer899
viewsFilter 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;…
-
0
votes0
answers206
viewsError while trying to connect sql server 2014 with Hibernate-core 5.2.7 Final
I am learning java with Ibernate. I am using Maven to manage the project. I can think of the following INFO error: HHH000206: Hibernate.properties not found as below in the image (click on the image…
-
0
votes1
answer56
viewsError printing a single variable
I am unable to print an ultra simple code in Java. It shows the following error: Exception in thread "main" java.lang.Error: Unresolved Compilation problem: Cannot make a Static Reference to the…
-
0
votes0
answers116
viewsHaving Stream<Stream> how can we get the Stream that contains more elements in the other Stream
I have 3 interfaces public interface IGhOrg { int getId(); String getLogin(); String getName(); String getLocation(); Stream<IGhRepo> getRepos(); } public interface IGhRepo { int getId(); int…
-
0
votes1
answer161
viewsCode Error for Popular Jlist with File Names of a Folder
I cannot pass a method to get the name of the files in a folder. I have the code below: inicializar.addWindowListener(new WindowListener(){ @Override public void windowOpened(WindowEvent arg0){…
-
0
votes1
answer1113
views -
0
votes1
answer2918
viewsHow do I use Optional.ofNullable() in this example?
In this example, how can I use this feature to avoid NullPointerException us get? public Pessoa parse() { Pessoa pessoa = new Pessoa(); RespostaPessoaEncontrada pessoaEncontrada =…
-
0
votes2
answers558
viewsEdit with Radio button in jsf
Well I’m starting now to develop with JSF and I’m with a doubt of how to do for my method edit receive the right object of the radio button , the way it is implemented it always takes the first of…