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

-3
votes
1answer
23 views

Advantages of following 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 ...
7
votes
6answers
566 views

Is overriding Object.finalize() really bad?

The main two arguments against overriding Object.finalize() is that: 1- You don't get to decide when it's called. 2- It may not get called at all. If I understand this correctly, I don't think ...
0
votes
3answers
88 views

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

Below is the diagram, where, if we just consider the implementations of List, 1) AbstractList maintains the core behavior of list. To introduce the new implementation class MyList(say) one can ...
-3
votes
0answers
19 views

Android developer transition to a Java Developer [on hold]

I've been an Android developer using Java for 2 years now. I have never learned Java from scratch, I just went straight into Android Development, watching hours and hours of video tutorials on ...
1
vote
1answer
41 views

Polyglot Node.js with Typesafe Akka for Actor Model

I have case that needs manipulate large stream of JSON and injecting it to Apache HBase. Our system works on Node.js with Mongo then, since we needs to enhance performance so HBase is choosen to ...
-5
votes
0answers
32 views

Memorization of sorting algorithms [on hold]

folks! I've been studying the sorting algorithms in Java and have been having troubles with implementing those methods without using the notes and/or any reference websites. I understand how each of ...
1
vote
1answer
18 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, ...
4
votes
4answers
92 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 ...
-4
votes
0answers
24 views

Small Java Application that communicates with my disk publisher XR [on hold]

I'm given a task to create a small java application that will communicate with the Disk Publisher XR when ever a job is sent to it, in a nut shell I'm developing a Just-In-Time Production website that ...
-4
votes
0answers
20 views

what are the Practical ways to implement API in JAVA? [on hold]

I got the API from this url:"http://resources.arcgis.com/en/help/arcobjects-java/api/arcobjects/com/esri/arcgis/geoprocessing/tools/conversiontools/CadToGeodatabase.html" I don't know how to use it. ...
0
votes
1answer
147 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 ...
-2
votes
0answers
18 views

Making a decentralized network of servers and clients in Java

I'm working on a java assignment.So far I've written a simple SQL-like program in which a Server stores all the data and different clients can be connected to it with their username and password, to ...
3
votes
1answer
97 views

Nested POJOs, exposing collections, detecting changes

I have a couple plain object classes to represent data read from a file. They look something like this: public class Command { private String name; private List<Message> messages; } ...
0
votes
0answers
74 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
78 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
0answers
73 views

Is java interface also good for defining core behaviors? [on hold]

This comment says that: Interfaces are also good for defining core behaviors! with one of the example taken as interface List<E>. My point of view: Taken from reference, item-18: Interfaces ...
-3
votes
0answers
24 views

To open a created java project from a javacode

I have created a java project via this syntax, IProject project= root.getProject(projectName); IJavaProject jproject= JavaCore.create(project); System.out.println(jproject); and i am ...
0
votes
1answer
85 views

Artificial intelligence decision making

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

How to structure my Android app? [on hold]

I would like to know how to structure my android app. I'm totally new to Android and i'm used to HTML/JavaScript/Java API. So while i already have a working Java API, i would like to use this one. My ...
-1
votes
0answers
40 views

how to write JUnit testing using inteliij idea? [on hold]

I am fresher in IT industry and new to writing tests specially of Junit testing tools.Can anyone help with few examples on Junit testing which will cover testcode on some complex programs
-2
votes
0answers
59 views

Having trouble with a for loop evaluating incorrectly [migrated]

I was having this problem today and I'm not sure what causes it. The following code: int totWidth = 19; String header = "Kalle's Numbers"; if (totWidth > header.length()) { for (int j = 0; j ...
2
votes
2answers
198 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. ...
2
votes
2answers
156 views

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

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 ...
5
votes
1answer
468 views

Scheduling a few CPU-intensive tasks

I need to schedule a small number of CPU-intensive tasks to run every so often, reading from shared data and writing to dedicated buffers. I don't necessarily want to roll my own scheduling, but am ...
-7
votes
3answers
126 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 ...
5
votes
4answers
541 views

Is it possible to use the Android layout system in a desktop java application? [on hold]

I am lazy, thus, if possible, I would like to only have to design and program a UI once. If I want to create an App for Android and as a basic Java desktop application, is there a way to reuse the UI ...
-3
votes
0answers
49 views

is it an implementation issue or a bug? [on hold]

As much as I know compiler must give an error of incompatible types, as Object Class is parent of all classes, so the statement Parent c2 = new Object(); must be erroneous, but compiler didn't give ...
0
votes
0answers
45 views

Java calculator - binary calculations converted into hex/decimal ones and vice versa [on hold]

Over the couple of days i made a very simple calculator in java, which was basically just adding/substracting/etc. two numbers. The two values where stored in double variables, as well as the result. ...
0
votes
2answers
43 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 ...
-3
votes
0answers
44 views

How to deserialize multiple objects from file [on hold]

I have this much code with me. Deserialization works fine for one object but not for many. i even tried by checking while((i=fin.read())!=-1) but it's not working Please help me with it public class ...
1
vote
1answer
290 views

Static methods vs Interface implementation

Here is my problem: I stared to create an e-commerce web site info collector. So I created a parser for each site. The parser class is stateless. I have got methods like: getItemPrice(WebElement ...
0
votes
1answer
89 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 ...
2
votes
2answers
149 views

Is it worth it to use a message-queue framework in this case?

We have these things called "executions" that are run at certain times. They have a delay property that basically says "execute me after delay microseconds`. Currently we are using Cassandra as a ...
10
votes
2answers
408 views

Packaging structure of Java collections (java.util) - why does Iterable sit in java.lang?

As per the below diagram, except for interface Iterable, all the remaining constructs (interface / class / abstract class) sit in same package java.util   Why does Iterable sit in ...
1
vote
2answers
127 views

What is the algorithmic time complexity of this program?

I wrote a simple program in java to create and maintain Dynamic Arrays: public class DynamicArrays { private Integer[] input = new Integer[1]; private Integer length = 0; private Integer ...
0
votes
4answers
102 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 ...
-4
votes
0answers
37 views

Java Program Output Incorrect [closed]

I am having a horrible time trying to get this program to output correctly. The program has no errors, but when I run the "test" it outputs: Also when I run the program to enter my own data the ...
0
votes
1answer
93 views

How are the forwarding of requests normally managed in the Chain of Responsibilty pattern? [closed]

I was just experimenting with the Chain of responsibility design pattern, implementing my own version. I'm currently reading Design Patterns, but I'm not really sure whether DP tells to stop the ...
-6
votes
0answers
22 views

How to build hotel reservation panel with month view in core java [closed]

I want to build a hotel reservation system for desktop using core java but when i come to reserve a room for multiple dates it becomes brick always, i also want a month view which show booked and ...
2
votes
2answers
306 views

A 'task' system which has an ending, to get ready for next task

I want to make a system, so that there are certain tasks. For example, let's talk about a game. I want to make it so there are 100+ tasks doing different things, but when the player's magic level is ...
1
vote
1answer
45 views

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

I want my program to: read some input lines from CSV file write the output lines to plain string file read some input from the same file in (2) and compare it to some calculated data I want to ...
1
vote
3answers
138 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 ...
3
votes
2answers
1k views

“Clean Code”: How to organize named queries?

Few days ago I started to read Robert C. Martin "Clean Code" book and it encouraged me to look more detailed at my code. After I opened eclipse I saw this: ...
2
votes
1answer
336 views

DataMapper for a MMO game plugin to send packets

I am working on an plugin for some game-server. The information about the plugin is not really necessary. Few points you might find helpful to answer to this question: The server The server is ...
1
vote
2answers
303 views

Mnemonic for always overriding equals when you override hashCode? [closed]

We java developers always know that you should always override equals() when you override hashCode(), but I consistently have trouble remembering this rule. What is a clever mnemonic to help Java ...
0
votes
1answer
29 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 ...
0
votes
0answers
64 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 ...
-3
votes
0answers
12 views

How to pass a string value to a String with “ ” [closed]

So it's kinda a simple thing but i can't find a way to do it without getting a syntax error.So i want to pass a string value from a variable to another.So lets say i have a variable. String view= ...
0
votes
4answers
198 views

Is collection object better being immutable? [closed]

As per this link, it is an advice that: A good object should never change his encapsulated state. Remember, an object is a representative of a real-life entity, and this entity should stay the ...
1
vote
1answer
113 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...