Casting Object From Class To Fit Generic

I have a Map that receives a Class<? extends EntityBase> and gives a GenericRenderer<? extends EntityBase>. Inside the GenericRenderer<? extends EntityBase>, there's a method called draw that takes a SpriteBatch and an object that e...
more »

2017-05-20 22:05 (1) Answers

Add Module to Gradle subproject

I have trouble adding a module to a Gradle subproject. This is my project tree: I want to add the io.grpc.example.helloworld sources from the build directory to the subproject. My main project (grpctest2) build.gradle: group 'andu' version '1.0-S...
more »

2017-05-20 21:05 (0) Answers

Multiple Nested Classes Java

Hi so I have a class that has mulitple layers of nested classes within it and I was wondering why it does not work. For some reason I cant create a new StackNode I was wondering why that might be. public class MultiStack { Stack1[] arr; int...
more »

2017-05-20 20:05 (1) Answers

Java Objects and arrays

I'm relatively new to java and i'm wondering how to go about writing this set of code. Currently I have a class to create an object for each name and number pairs from a list the user inputs public class Data { private String x; private int...
more »

2017-05-20 19:05 (2) Answers

Use DELETE request for not purely deletion in REST

I have a dilemma regarding the design of my REST API in Spring. Situation There is DELETE request to delete users by calling DELETE: /v1/api/users/{userId}, but it is not purely user deletion, i have to re-assign user tickets to another active user...
more »

2017-05-20 16:05 (1) Answers

Can not parse JSON in REST webservices

I have developed web service that can parse XML payload using JAXB framework. Now I need to extend this web service to parse the same payload in JSON format. The below logic that works for XML payload doesn't work for JSON payload. Appreciate your in...
more »

2017-05-20 16:05 (1) Answers

Ploting Date in Java and SQL

Hello I have some problems when ploting a Short Date column("FECHA") from an access database.This is my code when ploting: ResultSet rs2=statement.executeQuery("SELECT * FROM CITAS WHERE PACIENTE Like '"+user+"' "); if(rs2.next()){ toClient1.prin...
more »

2017-05-20 16:05 (3) Answers

Validate Input - String

I am trying to validate input from a textfield so that it only contains characters from a-z. I am using the following method to validate if the input is an int: //VALIDATE IF INPUT IS NUMERIC. public static boolean isInt(JFXTextField txtUserInput, S...
more »

2017-05-20 16:05 (3) Answers

java 9: JLink created invalid images

I am creating a sample application with 3 modules user, dept and account. In my user module, I have a main class and compile my modules with the following command: javac -d target --module-source-path src $(find -name "*.java") After compiling, ex...
more »

2017-05-20 13:05 (1) Answers

Intellij not including every file in build

I converting my JavaFX/TornadoFX project into a gradle project, I have all my resources in a package called resources... everything is working but when I build the project the packages, that don't contain any source code, don't move to the jar/build ...
more »

2017-05-20 13:05 (1) Answers

Getting indexes of maximum number in array

I have an array containing numbers which are ranks. Something like this. 0 4 2 0 1 0 4 2 0 4 0 2 Here 0 corresponds to the lowest rank and max number corresponds to highest rank. There may be multiple indexes containing Highest Rank. I want to fin...
more »

2017-05-20 11:05 (3) Answers

collecting from parallel stream in java 8

I want to take an input and apply parallel stream on that, then I want output as list. Input could be any List or any collection on which we can apply streams. My concerns here is that if we want output as map them we have an option from java is lik...
more »

2017-05-20 10:05 (2) Answers

How to choose Oracle JDBC pool vendor

The JDBC driver Oracle released has included the data-source and connectivity pool ability, e.g. PoolDataSource, OracleConnectionCacheManager and etc. why don't we use oracle jdbc standard functionality and we always use some external vendor provide...
more »

2017-05-20 06:05 (0) Answers

Understanding generic collection behaviors

When trying to better understand generics, I created two collections with different bounds. Note that I'm not gonna paste the class definitions here as they are self-explanatory. Also, to make things simple, everything is a class (no interfaces here)...
more »

2017-05-20 04:05 (0) Answers

Java8 Stream - HashSet of Byte from IntStream

I'm trying to create a HashSet<Byte> of bytes 1, 2, 3, ... 9 with the Java 8 Streams API. I thought using IntStream and then downgrading the values to byte would do it. I'm trying variations of HashSet<Byte> nums = IntStream.range(1, 1...
more »

2017-05-20 04:05 (2) Answers

Key Security - How to ensure that keys are secure?

Assuming that there is a Key Encryption Key that is in memory and not written to file or database... byte[] kek = new byte[32]; secureRandom.nextBytes(kek); byte[] kekHash = SHA512.hash(kek); And assuming that the Key Encryption Keys are ephemeral...
more »

2017-05-20 04:05 (1) Answers

Java String equality example

Sorry beforehand for a basic question but can someone please explain me why: String s = "lo"; String str7 = "Hel" + s; String str8 = "He" + "llo"; System.out.println("str7 == str8 is " + (str7 == str8)); outputs false. I thought that str7 and str8...
more »

2017-05-20 02:05 (4) Answers

Spring Boot disable @Cacheable per request

I'm trying to disable a Cacheable function in Spring Boot based on a URL parameter. For example http://myapplication.com/some/request?cache=false I tried the condition with SpEL but I haven't been able to get it work @Cacheable(value = "value", key...
more »

2017-05-19 23:05 (1) Answers

Java how to sort a list of IP Address

I want to sort a list of IP address in ascending order, what is the easiest way to achieve that? For example I have these IP Address in a List: import java.util.ArrayList; import java.util.List; /** * * @author myu */ public class SortListProje...
more »

2017-05-19 23:05 (5) Answers