Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

learn more… | top users | synonyms

1
vote
0answers
88 views

Approach for polyglot logging

I'm building a desktop app with a Java front-end and very performance critical Fortran libraries. We've recently started pushing more of our code out of Java and into Fortran (see below) Soon we will ...
2
votes
2answers
201 views

private method that uses no instance members - better static? [duplicate]

I have a private helper method that uses no instance variables or methods, I feel it would be less confusing if it was static (this way, it's given fewer points it can access). I am a bit unsure if ...
-2
votes
0answers
40 views

Data Driven Validation/Rule Engine in JAVA [closed]

I have data and series of validation (Business logic) before I can use it further. Like following :- { "site" : "UK", "domain" : "xyz.UK", "currency" : "DOLLAR", "type" ...
-2
votes
1answer
117 views

Does 'Iterable' interface look redundant in java? [closed]

By this below definition(pre 1.8) of Iterable, package java.lang; import java.util.Iterator; public interface Iterable<T> { Iterator<T> iterator(); } I would say that, Iterable ...
1
vote
0answers
40 views

Best JavaFX Pane of Structure for a Graph?

I will preface this question by saying that I am studying math and computer science at a university, but I have never been very good with graphics. I want to create a window that generates a square ...
-1
votes
2answers
90 views

Using nulls as Android application logic [closed]

I'm developing some Android applications. I am using null objects as the application logic. Is this approach okay or should I take another one and which one? Example: I use null objects logic when ...
0
votes
3answers
104 views

Surface Area calculations

For my program, I implemented AABB collision which works fine. When AABB collision detects a collision between 2 boxes, I want to find the surface area of portion where the 2 boxes are overlapping. Is ...
0
votes
1answer
48 views

How to better isolate JOGL or LWJGL3 dependency from game clients?

I'm currently working on a project to develop a relatively small framework with the goal of supporting game development efforts for students in a course. The scope of this project is an OpenGL-based ...
-4
votes
0answers
9 views

Upgrade to Weblogic 12c and using jaxws 2.1 [migrated]

Could you please explain if someone have occurred the following situation? I have upgraded the application server from Weblogic 10.0 to Weblogic 12c. Also I have generated a webservice using the jaxws ...
4
votes
3answers
211 views

Creating a Java project without using any objects and just calling static methods on input?

I'm creating a program which takes a document, extracts it, and then moves this into a database. I've done most of this now and I've realised that I haven't made any instances of classes I've made (I ...
0
votes
1answer
44 views

Promise Akka Play Java Sequence

I have an actor which is having three asynchronous web service calls. Lets say A,B and C. All return promise objects which has their respective response. I added loggers processA,processB,processC ...
-1
votes
2answers
68 views

Will statically typed, compiled programming languages be affected by Microservices Architecture? [closed]

Judging based on my experience, as systems grow bigger, statically typed languages like Java or C# tend to be more reliable and easier to manage. But do we need all the advantages of such languages ...
2
votes
1answer
86 views

What is the best way to store a formula in a database for a table driven formula? [closed]

So I am changing my code over to a table driven formula system to make it sustainable in the long term. So basically I have 5 foreign keys that will get me to a single formula to use. However I'm ...
0
votes
1answer
90 views

Moving methods to a MasterClass so it can be overridden, is there a better way?

I'm looking at a very large object within the application I'm working on, which is there to basically hold all the data together at a large level. Recently, we have started moving some methods out of ...
-3
votes
1answer
119 views

Good practice to hold Constants in their own file? [duplicate]

I've noticed some projects like to store constants in their own file, i.e constants used globally and in the main program loop might clutter the main file so perhaps they look to place them elsewhere ...
3
votes
1answer
157 views

How do I prevent a long running SQL query from looking stuck?

If I had a method like: private void someMethod() { runSqlQueryA(); runSqlQueryB(); runSqlQueryC(); } My understanding is this method will be one thread. In weblogic, the thread will ...
2
votes
1answer
221 views

How to approach legacy code? Desperate case [duplicate]

I have a methodological question. I am faced with a reasonably large legacy system (Java Enterprise). I am new to its codebase -as everybody in the team- since it's a product we had in outsourcing ...
1
vote
1answer
76 views

What is a good way for Tomcat to interact with another Java application running on the local machine

I'm new to using Java within a web environment. At the moment I have a Java application that we run on a local machine, we'll call it the server app. We want to add the ability to communicate with ...
1
vote
1answer
109 views

Behaviour of Thread sleep in a single core processor machine?

I'm trying to understand how threading works when using a single core, not hyper-threaded processor. I have two identical console applications running on a machine that has one core CPU and 1 GB of ...
0
votes
1answer
57 views

Missing super class from dependencies could throw NullPointerException java

Can someone explain if creating an object of a class that have in constructor the super call and the super class are missing from dependencies jar could throw a null pointer exception? e.g. a class ...
-1
votes
2answers
52 views

Creating Objects from a JDBC ResultSet, best practice?

I'm still in the process of learning JDBC and web services (currently forced to work with SOAP, but more interested in REST). I want to save each table row from the ResultSet in it's own object. There ...
-1
votes
0answers
18 views

java inetaddress isreachable not working [migrated]

I am trying to ping 200s of IPs in a loop in every 10 seconds. So, this loop gets executed in every 10 seconds. I was using this code to ping the IPs for (i = 0; i <= 200; i++ ) { ...
2
votes
1answer
98 views

How, in Three Tier Architecture is Database Access Achieved

So I am attempting to make an application based on the architecture proposed by this image; [1] However, I am getting very confused with how data access is achieved between the data access layer ...
0
votes
2answers
48 views

Built-in the separate thread execution inside of the method or wrap the method by the thread

Let assume, I have some resource and time-consuming code, which I want to arrange as a separate method. In order to optimize the performance, this code should be executed in the separate thread. Now ...
0
votes
0answers
36 views

JavaBeans vs. ActiveX: Strategic analysis

JavaBeans and ActiveX both serve the same basic function: to facilitate communication among software components within framework "containers." These containers include Web browsers and other document ...
2
votes
1answer
68 views

Is the output of a neural net supposed to have had the activation function applied to it?

TL; DR: Is the output from a feed-forward neural a direct result of the activation function? I.e: If the activation function is the sigmoid function, will the output always be between 0 and 1? I'm ...
8
votes
1answer
200 views

Java 8: Good practice to pass Streams around in APIs for lazy operations?

In pre-Java 8 lambda-heavy libraries like Guava, the outputs use common Java Collection Framework interfaces so is easy to pass them around to external/internal APIs and still harness some lazy ...
3
votes
2answers
99 views

Why can't I refer to an interface inside of generic brackets in a variable declaration?

I tried to write the following: public class AdjacencyList<Vertex> { Map<Vertex, Set<Edge<Vertex>>> adj = new HashMap<Vertex, HashSet<Edge<Vertex>>>(); ...
2
votes
1answer
77 views

How can my genetic algorithm accept an arbitrary number of bases of any type, without accepting a List?

Background: I'm writing a genetic algorithm to be used to control the weights of a neural net. To specify the bases ("bits" of the code) of the "DNA", I'm allowing the caller to pass in a ...
0
votes
2answers
78 views

Why i must validate attributes at JSF page?

I want to know the best pratice, to validate the attributes on jsf project. I know two forms of validation: Option 1: Validate on JSF page JSF Page validation: <h:inputText ...
12
votes
2answers
153 views

UnsupportedOperationException in java collections framework interfaces

Looking through the Java Collections Framework, I've noticed quite a few of the interfaces have the comment (optional operation). These methods allow implementing classes to through an ...
0
votes
2answers
81 views

AABB collision algorithm with a condition

So I'm doing a 3D implementation of collision detection. Considering Boxes are oriented on the axis. They are rotatable but has to be orientated on the axis. Box A and Box B cannot go through each ...
2
votes
1answer
139 views

Am I overdoing stuff when I sever interfaces from concrete implementations?

I've separated interfaces from their implementations by different packages, it's just add clarity, the separation is good looking and it is easier to navigate the project structure. I like it. The ...
22
votes
0answers
3k views

Why is this long overflowing to -1, instead of the minimum value for the type? [migrated]

I have the following code that returns the number of nodes in a tree when a complete Binary Tree is layer layers tall: public static long nNodesUpToLayer(int layer) { if (layer < 0) throw ...
2
votes
1answer
50 views

Getting items from a ListView - without breaking MVC paradigm?

I've got an arraylist of SpecialParts. A SpecialPart is an object that holds a bunch of information about itself: name, ID, date created, etc. I've got a ListView that presents the user with all the ...
-1
votes
0answers
23 views

Spacing Elements In Java [migrated]

I am having issues with spacing my fields and buttons on my GUI when I run my java code. I am looking for some help and explanation or a direction to a well made site explaining how to easily space ...
3
votes
1answer
107 views

Using a rules engine to manage client and server side validation of business rules?

Has anyone managed to use a common rules system between their frontend and backend? Similar to this question: Managing client-side and server-side validations in one place, I'm trying to find a way ...
1
vote
4answers
193 views

Java desktop app with mysql database

I'm currently in the process of learning Java and swing and in doing so am trying to create a desktop app. As part of this app I have set up a mysql database which the app is connected to, however ...
3
votes
2answers
128 views

Continuous Batch Processing in Java

My team has written an application which we've decided needs to run a process, we'll say about once a day, as long as the application is being used. I've never done anything like this in Java before ...
-3
votes
0answers
9 views

JButton not adding JLabel with an ActionListener [migrated]

I've started working on an extension of a project I've been working on for a few months, and I've felt the need to take it out of the console and put in in a GUI window. So far everything's going ...
-2
votes
0answers
42 views

How to get key depending on the value from HashMap [migrated]

I have a HashMap in Java (named queue) which with Integer as the key and List of messages as a value related to each key. I want to visit all values of List<messages>, and compare each entry ...
1
vote
2answers
84 views

What should be the best way to run a long operation in Java Spring?

I am working on a price comparator, one of the module of application crawls through the list of website against the product stored in the database and updates the price in the application database. ...
-3
votes
2answers
137 views

Advantages of these recommendations in ooprogramming using Java

Below are the recommendation from section 5.1 of this essay. While Java is not a pure object-oriented language, it is possible to program in a pure object-oriented style by obeying the following ...
-1
votes
3answers
264 views

Why List<E> interface is additionally introduced in collection hierarchy? [duplicate]

Below is the diagram, where, if we just consider the implementations of List, AbstractList maintains the core behavior of list. To introduce the new implementation class MyList(say) one can ...
1
vote
1answer
27 views

How can I avoid needing to check for the existence another vertex when adding to an adjacency list?

I'm writing a Graph, and decided to make the Adjacency List its own class. Right now, (stripped down) it looks like this: public class AdjacencyList<Vertex> { //A map between a vertex, ...
24
votes
8answers
3k views

Is overriding Object.finalize() really bad?

The main two arguments against overriding Object.finalize() is that: You don't get to decide when it's called. It may not get called at all. If I understand this correctly, I don't think those are ...
1
vote
1answer
92 views

Polyglot Node.js with Typesafe Akka for Actor Model

I have a case that needs to manipulate a large stream of JSON and inject it into Apache HBase. Our system works on Node.js with Mongo then, since we need to enhance performance, so HBase is choosen to ...
4
votes
4answers
121 views

Creating two-way object references and keeping data integrity

I have two different classes; a Player and a Group. I need to be able to query a Player which Groups they are registered to (player.getGroups()), and which Players are registered to a Group ...
1
vote
2answers
210 views

BDD, Cucumber best practices

I'm trying to understand some best practices when it comes to BDD and Cucumber. I've only recently started to use it, and the first feature I have written a test for is testing a search feature, more ...
1
vote
2answers
106 views

Joshua Bloch Enum Singleton and Third Party APIs

In the book Effective Java he give the best Singleton pattern implementation in his, that is implement by a Enum. I have doubt to how to implement this pattern with a third party API. I'm using an ...