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
1answer
802 views

Implementation difference between Lombok & AutoValue [closed]

I thought both Project Lombok & AutoValue used compiler annotation processors, but from this slide presentation and this stackoverflow answer it seems that Lombok doesn't... or at least not ...
-1
votes
0answers
30 views

get rules of Weka J48 Decision tree [closed]

I want to display a Weka classification tree to the end-user that I have generated using weka.jar in Java. But not the default tree in grey window titled as "Tree Visualizer" which is obtained via ...
4
votes
2answers
174 views

Exception versus return code in DAO pattern

After reading a lot about the abusive use of exceptions in Java and how you should let an exception bubble up through the different layers of an application, I've come to a point where I don't know ...
-1
votes
0answers
40 views

Spring mvc Hibernate DAO layer architecture [closed]

I need a suggestion related to project architecture...My project is spring MVC How can I create DAO layer using hibernate..there are two ways to do it 1. Create generic DAO and use it 2. Create DAO ...
8
votes
7answers
2k views

Does Oracle reap economic benefits by maintaining Java? [closed]

It occurred to me that many programming languages such as Python and Javascript are maintained by non-profit foundations. I can see why a foundation would update a free programming language- in order ...
-1
votes
0answers
29 views

Java platform/engine for blogging and forum [closed]

I have a task to build a website which supports user registration and login, would have a forum and would have multiple blog-like pages/streams for news, upcoming events etc. The page should allow any ...
1
vote
2answers
99 views

Caveats of using String.hashCode() on a switch on java < 1.7

There are several cases when I want to switch over a String input. I decided for implementing something like: public Object doStuff(String param) { switch (param.hashCode()) { case 1234546: ...
1
vote
2answers
134 views

My value checker function needs to return both a boolean and a message

I have a value checking function, something much like a credit card number checking function, that is passed in a string, and needs to check that the value is of the right format. If it's the right ...
89
votes
11answers
23k views

What backs up the claim that C++ can be faster than a JVM or CLR with JIT? [closed]

A reoccurring theme on SE I've noticed in many questions is the ongoing argument that C++ is faster and/or more efficient than higher level languages like Java. The counter-argument is that modern JVM ...
-1
votes
0answers
19 views

WLP Transformer implementation in Java? [closed]

Input for our program is array of instructions (Expression [] instructions). Then iteratively starting from last instruction, and going backwards we searching for weakest pre-condition of single ...
1
vote
2answers
73 views

Adding Logging to a pre-existing Program

I have a game that I have been writing in java as a hobby for a number of years. I have very sparse logging, just some simple output when something goes really wrong. It's about 25,000 lines of code. ...
0
votes
0answers
3 views

I'm trying to solve the “knapsack” problem using Java and recursion [migrated]

This is for a school assignment and the professor stipulates that recursion must be used, and it must take a single line input in a gui box where the first number is the max capacity (weight) the ...
9
votes
11answers
6k views

Do I have to learn html and javascript to create web applications? [closed]

I am an experienced Java programmer, and I want to create a complex web application requiring dynamic pages, drawings, etc (take SO as an example). Do I have to learn javascript/html in order to ...
2
votes
1answer
43 views

Transactions and subresources with JAX-RS

I'm porting an existing application RESTful API to a Java web framework -- I don't actually care which -- but it's proving hard to get the basics right. The core of the problem appears to be getting ...
-3
votes
1answer
55 views

Request for some general advice from someone moving into software development [closed]

I've had a look around the StackExchange sites and this one seemed to be the most appropriate for my question. Apologies if I made the wrong choice, and I'm happy to hear alternative places to post. ...
-1
votes
0answers
38 views

Question concerning loops [migrated]

Hey guys first time posting on here, I have to make a program for school that asks the user to input the amount of items they want, and their respective price. After that they have to input the GST, ...
0
votes
1answer
46 views

Pattern for separating UI code from logic in Wicket

I'm using Apache Wicket for developing web apps, I have developed a few for the last year and it has been great; today I was looking at a few pages and most of them look like this: public class ...
1
vote
2answers
199 views

How to add rigor to my testing?

I work on a small/medium sized Java application. Over time, I've tried to ensure that the tests which I write are "good" tests, and that there's plenty of them. Hence I've been looking into various, ...
3
votes
1answer
104 views

Retry design for high volume

I have a Java system using ActiveMQ for messaging. And the system processes about 400 to 600 transactions a second and we have no issue when everything is running smoothly. The system also got to send ...
-2
votes
0answers
41 views

Learning servlets and JSP help needed [closed]

As I just learnt the basics of Java, now I am Learning Servlets and JSP . First of all, I already installed Apache Tomcat in Eclipse and it is already set up.Secondly I have I am currently reading the ...
24
votes
3answers
2k views

Introducing Scala to a Technical Manager

I've been promoting Scala at work as something we should try out for things like testing with Specs http://code.google.com/p/specs/ and rapid prototyping of web services with tools like Scalatra ...
0
votes
0answers
28 views

Enforce coding decision to include or exclude an Enum element in an EnumSet at compile time

I would like to enforce that the elements of a Java Enum are chosen or excluded from an EnumSet at compile time i.e. I am forced to make the decision to put it in the set or not whenever I create a ...
0
votes
1answer
104 views

Producing JSON objects from JPA entities in REST API

I have a REST service producing JSON and consuming JSON. A lot of this are simple CRUD operations. My initial idea was to simply use the DAOs directly in the controller: @ResponseBody() ...
-2
votes
0answers
54 views

What are the Pros and Cons of recursion over loops? [duplicate]

What can be said for the benefits and negatives of recursive functions over using a loop? For example. Is it just a matter of writing less code? Surely recursion has the potential to StackOverflow ...
0
votes
1answer
504 views

HTTP Session: A single object or multiple?

I tested two approaches to store session data: The classic: 1 key, 1 object (And every key as static final String in a class) "user" --> UserObject "preferences" --> List ... An ...
1
vote
2answers
119 views

Is it a good idea to require passwords in offline applications?

I am developing an application which can install extension modules (plugins, if you will) from APT-style repositories hosted elsewhere. The plugins need not be signed (although the downloads are ...
2
votes
1answer
163 views

Object caching in this code too expensive?

I'm having some trouble with a game developed in Java which is kinda slow. I benchmarked it a little bit and found the problem: most of the time, the JVM is in the Object.<init>() since there ...
1
vote
2answers
129 views

Smells in exception handling: how to separate between public and internal exceptions?

During the development of a small web API, we decided to separate internal exceptions from public exceptions. Public exceptions are HTTP exceptions, that translate into HTTP responses with proper ...
0
votes
1answer
329 views

String[] args vs (String . . . args)

When programming for android, whenever I use an AsyncTask the doInBackground method looks like this. protected String doInBackground(String... args) But when using the arguments anywhere in that ...
0
votes
0answers
21 views

do my “dal” and “fileHandler” interfaces overlap?

I want my program to: 1) read some input lines from csv file 2) write the output lines to plain string file 3) read some input from the same file in (2) and compare it to some calculated data. I ...
3
votes
1answer
3k views

How to calculate percentile in Java without using Library

I am trying to calculate 95th Percentile from the data sets which I have populated in my below ConcurrentHashMap. I am interested in finding out how many calls came back in 95th percentile of time ...
2
votes
4answers
4k views

Java class to enforce an implementation of super classes' public methods

I have the following : public Class A { public void methodA() { .... } public void methodB() { .... } } I don't have control over Class A. I would like to create ...
1
vote
0answers
83 views

Optimal data structure for binary data/Java

I have several input formats mostly restricted to geotiff and some proprietary binary formats. I import them into my program and then need to export them into various other data formats (also binary) ...
-1
votes
0answers
20 views

Data Type of file_get_contents of php in java [migrated]

I am trying to upload an image to the database with blob datatype. I use web-service method addProfilePic that store the blob data to the database with my Codeigniter project. I retrieve the image ...
4
votes
1answer
134 views

What are the reasons for sealing a .jar and how would I verify that?

I have created a sealed jar, but I don't see difference compared to using a non-sealed one. What tests I can perform to verify the jar is sealed? What reason we could have to prefer using a sealed ...
5
votes
2answers
925 views

Should I use mMember and sStatic naming convention in Android?

Android source code and many Android open-source apps and libs use m prefix for member fields and s prefix for static member fields: private static boolean sStarted; private long mTimestamp; I ...
0
votes
2answers
242 views

What is the rule for nested loop code?

I am new to programming and currently learning Java from Stanford free learning course. There was this assignment that I had trouble translating my algorithm into code. I feel like I have a ...
0
votes
1answer
30 views

Handling DomainExceptions using REST endpoint

Suppose I'm doing some DDD. Now, I have a microservice reflecting a bounded context/a part of a bounded context. Now, suppose there is a REST endpoint: '/somedomainmodel/someaction' My API user is ...
0
votes
1answer
87 views

advantage of having multiple REST web services

I have a application designed using Spring REST service. the application has two REST projects: Web Core Web has html, JavaScript and Java classes (ajax calls this REST). These Java classes in ...
0
votes
0answers
44 views

How and where to make global function file in jsp sevlet web application

I am making a website in Servlet&JSP. I am looking for good way to make a specific function file from where I can call and declare my common functions. If I made a java file function. Java, so is ...
2
votes
2answers
117 views

Does anyone else feel like confused even after they're done studying programming tutorial? [closed]

I am learning core java and I was studying from java trails on oracle website. When I was done learning the Thread trail, still there was a sort of confusion and blurriness at the back of my head. I ...
28
votes
8answers
4k views

Is throwing an exception an anti-pattern here?

I just had a discussion over a design choice after a code review. I wonder what your opinions are. There's this Preferences class, which is a bucket for key-value pairs. Null values are legal ...
-2
votes
0answers
23 views

Minecraft Server - Get list of online players (Java) [migrated]

My question is: How do I get a list of online players, not the count of the online players, in Java? //So I could call... String[] players = getPlayers("fnaf.hosthorde.net"); That is how I'd like ...
0
votes
1answer
128 views

Dealing with several custom getters

I have a data structure with data units containing different types of data. I've wrapped the data in "Field" objects so that each field is able to independently parse user input in a desired way. ...
0
votes
3answers
71 views

Best approach to implement an update operation of a container object?

I have an Invoice object wich may contain several FacturedServices objects stord as a list. In may interface, the user can edit an Invoice object, delete add or edit its FacturedServices list. Whe ...
0
votes
0answers
45 views

Possible way to make java class builder more abstract by using interface required keys

I'm looking for a more abstract pattern for builders that handles required fields without the need of writing a validator that checks if all requried fields are set. I like this builder. But is ...
0
votes
1answer
82 views

Is set of libraries called API only if it talks to a system/server?

I have read few articles about API. Can't find the reference now. In some of them, they define API as set of tools, routines and protocols which are helping programmer to build a software with use of ...
17
votes
7answers
3k views

Why is instance creation the way it is?

I've learned C# over the course of the past six months or so and am now delving into Java. My question is about instance creation (in either language, really) and it's more of: I wonder why they did ...
2
votes
0answers
233 views

Which patterns/architecture to apply for “Import Data, Process Data, Export Result”

I was wondering which architecture/patterns to choose for the following problem divided into three steps: Import TestScript Description from File (e.g. .xls, .txt) Process Described TestScript ...
2
votes
1answer
147 views

How to efficiently handle related data in MVC?

Talking about MVC with servlets and JSP's, in a context about products and manufacturers , when querying the application for a list of products: the servlet loads a list of products from the ...