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

-5
votes
0answers
18 views

Reading Specific Files With Multiple Separators [on hold]

Ive been trying to make a program/game that uses a file to customize 'ranks' or 'stats' in game. The file uses commas ( , ) and semicolons ( ; ) to separate different parts from each other. Ive been ...
1
vote
0answers
22 views

Handling cases where the message queue is unreachable

We are using Apache Camel with ActiveMQ in a microservice architecture in a growing system of integration solutions. I was wondering how each service should react when they are unable to connect to ...
-3
votes
0answers
23 views

how to do spark groupbykey values to Cartesian product

I want to process groupbykey values to self cartesian product. Example: group by key results is RDD[KEY, Iterable[VALUES]], for each key corresponding values to self cartesian product. Here is code ...
-1
votes
0answers
11 views

Filling AutoCompleteTextView based on RadioButton selection?

I am making an app which is supposed to fetch data from an SQLite Database and display it. I have made that part, and was trying to improve the search box. I am using an AutoCompleteTextView for that ...
-2
votes
1answer
82 views

What options do we have to handle operating system things in Java?

Threre are many application running wherein handling of operating system is required. For example remote desktop access application like ammy admin, or even CC cleaner, some application make use of wi-...
0
votes
0answers
37 views

Updating class property inside the method vs. returning a value from the method

In a large code base, what is a good practice between: Updating class properties inside the method vs. returning a value from the method and updating the property in the place where the call to the ...
5
votes
3answers
4k views

Best approach for multilingual Java Enum

I'm running into issues with an approach I am taking and am now wondering if I just started down the wrong path and should rethink my approach. Here is what I attempting. I would like to use an Enum ...
1
vote
1answer
207 views

Are recursions intrinsically less safe than iterations?

Java doesn't have a predefined recursion depth limit. As a result the recursion below (a dummy method that returns the value) throws java.lang.StackOverflowError after 62844 (with static) and 14002 (...
0
votes
1answer
41 views

Is Multi-Tenancy a viable option in any Java RAD Frameworks?

I've worked as a Full Stack Java Web Developer for many years now and of all the projects I have worked on two things are true of all of them: They were all Multi-Tenant applications with one ...
-4
votes
0answers
21 views

Error executing stored procedure query in JPA [on hold]

I'm getting a resultset error while trying to fetch data from a stored procedure. Here's the stored procedure: create procedure Proc_Member_Statement @Counter int,@TransDate datetime as declare @...
1
vote
1answer
175 views

How to efficiently store code snippets?

I've noticed that a lot of my work follows this pattern: (1) Decide that I need to add a behavior (say, align table columns right) (2) Recall that I did it few months ago on a different project, try ...
3
votes
0answers
76 views

Best practice for ensuring name uniqueness/correctness in message queues in a microservice architecture/distributed system

I was wondering what a good solution would be for ensuring that queue-names are entered correctly and are only used by the correct applications in a large system which uses message queues to exchange ...
-7
votes
0answers
33 views

why,where and when to use static variable and static method?

class Student8{ int rollno; String name; static String college ="ITS"; Student8(int r,String n){ rollno = r; name = n; } void display (){System....
0
votes
1answer
178 views

NoSQL in Java Enterprise Application

I'm planning a large scale enterprise application that requires reliability and standardization comfort that Java EE provides. At the same time, I'm wondering if I go for Java EE, will I be able to ...
8
votes
2answers
402 views

Why are checked vs. unchecked exceptions called “the controversy” in Oracle Java tutorial?

I am new to Java and was reading its documentation on exceptions., and especially the Unchecked Exceptions — The Controversy page. The bottom-line says: If a client can reasonably be expected to ...
2
votes
3answers
150 views

C++ vs Java: Pointing to Objects

In Java: private State current_state; As "State" is a superclass, I can then assign subclass objects to current_state, effectively making current_state point to a different object: current_state = ...
-2
votes
0answers
15 views

Using The Apached Math Libraries with BigDecimal [on hold]

I need some working java code that uses that combines the apache math libraires to solve a 2 variable system of equations. An Example would be something like this Contraints x not equal to 0 x < ...
0
votes
0answers
23 views

Hybrid sql / nosql

I have a problem that doesn't seem to have an immediate fix and it confuses me. My main application stores data in mysql: Users Websites (metadata) Pages (metadata) The actual pages ...
1
vote
1answer
59 views

jersey post with a huge payload

I have a requirement to write a POST endpoint where the payload is huge(not normal). In the order 10s of Megabytes. And this endpoint will be accessed by a lot of clients (in the order of 1000s) ...
0
votes
2answers
76 views

Store and access my objects using an int id

I have created a class HidDevice to form objects which concatenates input from each HIDDevice separately until a special key (ENTER) is pressed. So each instance of HidDevice have fields like int ...
1
vote
2answers
167 views

Designing validation classes

This is a follow-up of this question. I decided to implement what the accepted answer suggests, however, I realized I also needed individual public methods for each member the entity to be validated ...
3
votes
2answers
289 views

Is accessing lower tier members of an aggregate to perform an operation bad practice?

I am currently building a small project that is supposed to keep track of recipes. Each recipe has a bunch of information, including a rating for said recipe. Since the rating has some additional ...
-1
votes
1answer
22 views

How to handle xml element with both CDATA and regular data using SimpleXML

I'm struggling to understanding how I can deserialize the following response from an RSS feed. I need the text blah blah blah etc as well as the embedded image source http://host/path/to/picture.jpg. ...
-3
votes
0answers
25 views

How can i change the element of XML using XSLT [on hold]

I am new in XSLT. My Requirement is: I have one XML something.xml It Contains <Parent> <child1> <firstname>abcd</firstname> <lname>dcba</lname> </...
1
vote
1answer
49 views

Parse both en_US and en-US as locale in Java

I am writing an API (using Java) that takes locale as a parameter. We want the clients to be able to specify "en-US" or "en_US" as they both seem to be widely used across all languages. I did go ...
1
vote
1answer
48 views

How to deal with different configurations with non-overlapping properties?

I am working on a project based on the Java EE technology. First I'd like to tell you what I want to achieve, then what I already tried. Task: Imagine two types of configurations, which you want to ...
1
vote
2answers
134 views

Opportunity cost of DIY DI?

Java here. I have always used Spring DI (for Spring projects) or Guice (for non-Spring projects) for dependency injection, and have always loved them. I recently took a job where they do 100% "DIY DI"...
1
vote
0answers
1k views

Spring bean injection into a hibernate validator constraint

I have a controller method like listed below whose argument is annotated with @Valid to validate PasswordChange object using a Hibernate validator @Constraint. Both PasswordChange and a sample ...
2
votes
2answers
103 views

Would it be possible to create a class during runtime execution?

This might be a little unrealistic bu i will ask anyway. Would this be possible to create literally create a new class during the run time execution, i don't mean a new instance, i mean a new class ...
0
votes
1answer
116 views

What algorithm or program does Java use for arithmetic?

I was looking at bitwise ways to multiply and add numbers without using * or + operators. But I want to know that it might be possible that java may already be using a better approach underneath. I ...
1
vote
1answer
400 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 ...
4
votes
3answers
1k views

Software licensing and Copyright of Open source

I have seen some source code containing Copyright notice in the beginning of the file. Most of them are either GNU General Public License or Apache License. If I want to develop any open source ...
2
votes
2answers
162 views

Is 20 Java classes for just making a REST call too much?

In an Android project, I am using dagger 2 for dependency injection, applying mvp design pattern, and I am writing interface for almost every class. Although it does achieved the separation of ...
1
vote
1answer
59 views

Java PrintWriter vs JSP

I just want to ask an opinion, which are the best practice to use html between this two option: 1) Use JSP by creating html page there 2) Generate html using Java server side by using PrintWriter ...
0
votes
0answers
47 views

How to handle ID's with resources that can be combined?

Early on in my app, there were simple Customer objects with an int id. In my database, some customers are split into multiple accounts for organization purposes. For ex. "CustomerA" (Main account) (ID:...
0
votes
2answers
100 views

Best Communication strategy for monitoring dashboard

I have a requirement where I need to display certain stats on Admin Dashboard in my web application (Angular+Java). These stats (transnational data) are being generated on different servers (connected ...
0
votes
1answer
85 views

How do I integrate hibernate and REST web service in java?

I am going to develop which will be web application as well as mobile (android / iOS / windows) application. The database in this application will be managed by Hibernate. Also as it is cross platform ...
-2
votes
0answers
29 views

Need help in optimizing my arraylist class which contains combination of pair [closed]

Need help in optimizing my arraylist class which contains combination of pair: import java.util.ArrayList; import java.util.List; public class FieldsProvider2 { private MyObject object; private ...
2
votes
3answers
534 views

Could the creation of many methods in Java affect performance? [closed]

I was told by a colleague that in Java, the performance may be worse if we create more methods, stacking many methods calling over them in JVM, specially in a Java EE environment. This seems to ...
13
votes
3answers
1k views

The suffix Exception on exceptions in java

Specifying a suffix of Exception on exception classes feels like a code smell to me (Redundant information - the rest of the name implies an error state and it inherits from Exception). However, it ...
21
votes
3answers
3k views

Why should I use “functional operations” instead of a for loop?

for (Canvas canvas : list) { } NetBeans suggests me to use "functional operations": list.stream().forEach((canvas) -> { }); But why is this preferred? If anything, it is harder to read and ...
2
votes
2answers
615 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 ...
0
votes
0answers
22 views

Templating changes in Spring boot 1.3

I am currently studying java using Maven, Spring boot, and SVN. I have been assigned the task of getting both the revision number and timestamp of the project to store in a text file and eventually ...
0
votes
1answer
95 views

Divide java web app into smaller web app

I've a web application that consists of 3 main technologies: JSF, jax-rs and websocket. All three are coupled together with the help of CDI injection and JPA. That means that when a user login, he ...
9
votes
4answers
692 views

Programming style in Perl

I work in Java so basically I use OOP paradigm during coding. I am about to start working in Perl and I was wondering what is the paradigm that Perl developers follow. In wiki it mentions that it ...
2
votes
3answers
203 views

Preemptive interfaces in Java - good, bad or “a matter of taste”

I frequently come across projects that strictly define an interface for each and every class. 90% of those interfaces feature only a single implementation. Proponents of these "preemptive interfacs" ...
-1
votes
2answers
144 views

Is there a way to refactor the given code snippet without using if statement? [closed]

I am very new to java programming and I recently learned that using too many if else condition statements is not a good programming practice, and I am wondering is there a way to refactor the below ...
1
vote
2answers
89 views

Create jar of a java application where entry point is an external program

I have a java plugin written for a software called icy. Since the entry point of program is when the plugin is activated from the software, I am having trouble about how to mention that in manifest.mf ...
0
votes
3answers
148 views

Cyclic dependency in this project design

I have 2 modules (containing multiple classes). Let's call them Module A and Module B. Module B has a dependency on Module A: Module B -> Module A. Now, I have created an utility class C, which A ...
-3
votes
0answers
32 views

How can i get two input simultaneously using scanner? [closed]

In my program i'm getting two input but it return one value another as null. i couldn't find out. please anyone clarify my error. Input: k 1 output: king of null public class Cards { ...