Jackson is returning duplicate rows

I am trying to return json from these two entity classes. Questions.java @Entity public class Questions { @Id @Column(name = "id") private int id; @Column(name = "question") private String question; @Column(name = "type") private String type; ...
more »

2017-03-19 19:03 (2) Answers

Read objects from a .class file

I'm trying to use Javassist in order to get all the instantiated objects in a .class file, however, I can't seem to find the way to do so, so I ask, is there any way to get, for example, an array of Objects from a .class file? Here is the class from...
more »

2017-03-19 19:03 (1) Answers

Merge two sorted linked lists in java

I need to merge two sorted linked list into one sorted list. I've been trying to do so for hours, but when I reach the end of one of the list I always have some trouble. This is the best I could do. My filaA and filaB are liked lists of data type "lo...
more »

2017-03-19 17:03 (2) Answers

javax.persistance.Entity not getting imported?

I was trying to get my hands on spring data auditing. So I started with a simple build.gragle which I wrote below. But I was not able to get all the classes for javax.persistence.* What I mean is @Entity over any POJO was giving me cannot resolve sym...
more »

2017-03-19 16:03 (1) Answers

How to know if a thread is finished in Java?

Working on a Java project and I would like to know if a thread has finished the required calculations. First attempt: done variable in runnable The first class is a manager import uckochfractalfx.UCKochFractalFX; public class KochManager { p...
more »

2017-03-19 13:03 (3) Answers

Get fraction from division of longs in Java

I want to get the fraction (modulo 1) of the quotient of two long values. long dividend = 50L; long divisor = 3L; float n1 = (dividend % divisor) / (float) divisor; float n2 = (dividend / (float) divisor) % 1; System.out.println(n1); System.out.prin...
more »

2017-03-19 07:03 (1) Answers

Deep copying Generics in Java

I have a programming assignment to make a generic stack in Java and I need to make a deep copy of newNode T. I don't know how to make a method deep Copy that can access its self and output i'`s deep copy. So far, I have this: public class Stack<...
more »

2017-03-19 03:03 (1) Answers

Gradle inspection doesn't works fine

I have IDEA marks all inside attributes colons with warning! task configureJar (dependsOn : 'generateVersion', type : Jar) { archiveName = "${applicationName}_ver${version}.${extension}" println archiveName manifest { attributes(...
more »

2017-03-18 23:03 (0) Answers

Sorting an array based on calculated values

For a recent java coding test I had a question similar to the following: A function receives a string of comma separated values. Add the digits of each number contained to create a single value for that number. Order these in ascending order Return ...
more »

2017-03-18 22:03 (1) Answers

Comparing two selection sort methods

This question is similar to (link) but not exactly what I am looking for. Here is a selection sort I wrote below, it's in Java. public void sort() { int smallIndex; for(int i = 0; i < arr.length; i++) { smallIndex = i; ...
more »

2017-03-18 19:03 (2) Answers

Can't open JAR files with JRE installed?

I have several JAR files that I was able to run several days ago; however, now my Mac changed them to be opened with the Unarchiver program. I don't see any options for opening the file with the Java Runtime. I installed the latest update with no ava...
more »

2017-03-18 15:03 (1) Answers

Thread locality

I have this statement, which came from Goetz's Java Concurrency In Practice: Runtime overhead of threads due to context switching includes saving and restoring execution context, loss of locality, and CPU time spent scheduling threads instead of ...
more »

2017-03-18 00:03 (2) Answers