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
votes
2answers
79 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
106 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
93 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
124 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
176 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
229 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
2answers
146 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
114 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
61 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
85 views

Creating Objects from a JDBC ResultSet, best practice? [closed]

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 ...
2
votes
1answer
108 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
52 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
37 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
97 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
241 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
108 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
83 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
84 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
168 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
83 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
141 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 ...
2
votes
1answer
60 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 ...
3
votes
1answer
138 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
341 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
146 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 ...
1
vote
2answers
100 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
148 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
279 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
28 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
112 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
126 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
284 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
117 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 ...
0
votes
1answer
111 views

Artificial intelligence decision making [closed]

So I am working on a artificial intelligent assistant that is supposed to help you making correct decision when playing the game domino. Basic rules: http://www.pagat.com/tile/wdom/caribbean.html As ...
2
votes
2answers
176 views

Java: using final keyword only on method parameters that expect immutable objects? [closed]

I came across the interesting topic about final method parameters and that they essentially don't provide much advantages. I wondered if it would be sensible to mark only those method parameters as ...
0
votes
2answers
51 views

Using GNU GPL with classpath exception licensed library in a GNU GPL licensed project

I am working on a project that uses ABCL. License of ABCL is GNU GPL with classpath exception, which means we can link this library with independent modules to produce an executable, regardless of the ...
1
vote
2answers
154 views

Is the use of set / get prefix discouraged for methods if they don't actually mutate / access fields

This could be a quirk of the IDE I am using, Android Studio, or it could be something more nuanced that I don't understand. I have a method setCustomFont that appears as a property in the Structure ...
-6
votes
3answers
171 views

Why different languages have different syntax? [duplicate]

Different programming language always/most of the time use different syntax. For example take PHP, Java and Python. In Php & Java semicolons are compulsory at the end of the line, yet Python ...
2
votes
2answers
234 views

interpretation of the statement in java

I am confused over the interpretation of the following statement Fruit x= new Fruit(); My interpretation is that the new operator along with Fruit(); creates a new object somewhere in the memory. ...
0
votes
1answer
74 views

JEE MVC, controller calls the interface instead of the interface implementation

I'm following this tutorial: http://wiki4.caucho.com/Building_a_simple_listing_in_JSP It creates a basic web application in Eclipse using the MVC pattern with Resin as the web container. Here's the ...
1
vote
3answers
245 views

How to use Guice for an effective API Design?

I am creating a base API in JavaSE, which includes modules like MVP architecture, Service & Repository Layer, Event Model to fire events between presenter etc. I am trying to implement all best ...
1
vote
1answer
104 views

Pattern to share fields in inheritance

I'm trying to figure out the best way to solve a design issue. I have to be able to clone (I'm cloning them to Apache HttpClient) different types of HttpServletRequest (POST, GET...) and then send ...
0
votes
1answer
26 views

Where to store (data) classes for webservices

So I'm pretty new in my current company and my current task is to create a webservice that sends some serialized java objects from service A to service B using jaxws (webservices). The senior on the ...
0
votes
2answers
99 views

guideline on void methods that do not throw exceptions

In our codebase I saw a method that is similar to following: public void doSomething() { try { ... } catch (Exception e) { ... //log something ... } } ...
0
votes
2answers
140 views

Efficiently find whether Binary Search Tree is Height Balanced or not?

A binary tree is height balanced if and only if the two subtrees of root are height balanced and the difference between the two subtrees height is at most 1. I implemented a code in java to find ...
-3
votes
1answer
90 views

Java - Best way to set properties of an object [closed]

I don't know if there is any difference in performance, or its just a matter of choice, but I am a perfectionist like that, and I'd like to know. Lets say you have the object HolySheet. You can set ...
0
votes
0answers
41 views

DDD Request Validation Handling

I stuck somewhere that I can't find a solution! There are plenty of validation questions here, but as far as I see, most of them were asking about entity validation. But what about request validation? ...
4
votes
1answer
125 views

Where to initialize objects

I have an BallEntity class that is part of a game that uses a Entity Component System architecture. This class have 'components' that are like the attributes of that class. I create and initialize ...
1
vote
0answers
64 views

Efficient extensions of degree of separation

I'm trying to play around with the 6 degrees of separation problem, specifically the Kevin Bacon game to find alternative ways of playing the game. I want to eventually port it over to MapReduce, but ...