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

0
votes
3answers
128 views

Should a complex unifying class be doing computation?

I have a large application in Java filled with independent classes which are unified in a PlayerCharacter class. The class is intended to hold a character's data for a game called the Burning Wheel, ...
2
votes
1answer
171 views

Dependent Object Serialization

What's the recommended way to serialize dependent objects, especially when objects are being freshly constructed (to avoid malicious byte streams, or whatever)? For example.... After creating a ...
6
votes
2answers
7k views

Best way to structure a Git repository for Maven

I need some advice on how to structure our projects in Git. We use Java and Maven is our build tool. Maven kinda assumes all of your projects have a common ancestor eventually. Maven can also be a ...
2
votes
1answer
122 views

Java MVC extra classes

I have a simple MVC project. My current packages: gui controller db domain I want to put extra classes which I will use, e.g. md5 hashing, email validator (methods which I will use in more than ...
1
vote
0answers
352 views

Maximum flow and minimum cut undirected graph java

I need to implement an algorithm where I find the maximum flow and the minimum cut of an undirected graph and I cannot really find an algorithm for this. I have looked at the Ford Fulkerson algortihm ...
1
vote
1answer
108 views

MorphAdorner Licensing confusion

I want to use the MorphAdorner library available free for commercial use. But it uses several other libraries that restrict commercial use (like Gate etc). Can I use this library in my application?
15
votes
5answers
962 views

Is this pattern bad? [duplicate]

I notice that when I code I often use a pattern that calls a class method and that method will call a number of private functions in the same class to do the work. The private functions do one thing ...
10
votes
2answers
8k views

Entity to DTO Usage

Been trying to come up with a flow for a basic tiered web application, and have been reading conflicting information online. What I'm trying to figure out is if there is an advantage to still using ...
-1
votes
1answer
580 views

Name of this algorithm (Create binary image)

Some days ago I saw in this site the algorithm below to convert color images to binary images and I used it in my application (with some small changes). However, I need to know what is the name of the ...
2
votes
4answers
628 views

Find the count of each word in a string

I am in a search of a better performant algorithm to implement a program, to find the count of each word in a sentence i.e.., a String in the programming sense. I know my algorithm is too basic and ...
0
votes
1answer
424 views

Is there a tool that will list all dependencies of a method in Java? [closed]

Say I'm looking at some code and I see: MessageDigestPasswordEncoder encoder = new MessageDigestPasswordEncoder("SHA-512"); Now, in that file I also see: import ...
2
votes
1answer
95 views

Way to allow inspection of java data model after exporting to file

I've refactored a program to remove its dependency on an sql database by storing all the state in a memory model. However the manager liked the ability to easily inspect the domain state just by ...
0
votes
1answer
212 views

Standard Java Error Reporting

I am currently working on creating a toolkit for work and I've gotten to the point where I'm wondering about error reporting. Basically all of my tools, which consist of a grouping of classes, will ...
82
votes
18answers
10k views

Is it poor programming practice to pass parameters as Objects? [duplicate]

So, we've got a guy who likes to write methods that take Objects as parameters, so they can be 'very flexible.' Then, internally, he either does direct casting, reflection or method overloading to ...
3
votes
2answers
721 views

MVC framework that uses classes instead of methods for actions

In most MVC frameworks, Controller class contains multiple methods, each representing one action. Then annotations and reflection is used to call those methods appropriately. But from OOP point of ...
3
votes
2answers
2k views

VPS vs Web Hosting: Which one is good for java web services [closed]

I have some questions about VPS and web hosting. As far as I understand, VPS is a virtual machine on which we can do anything as we can do with our local machine. Install software, change settings ...
0
votes
2answers
491 views

Overriding - Access to Members with Reference Reassignment

I have recently been moving through a couple of books in order to teach myself Java and have, fortunately, mostly due to luck, encountered very few difficulties. That has just changed. I read a ...
0
votes
1answer
2k views

Sorting an ArrayList by a Split Value [closed]

I am attempting to create an list which should be sorted by a particular field in a colon separated string. I have an array of strings with the following values: name1:535 name2:697 After sorting ...
0
votes
1answer
76 views

Defining a status between last check and now

I have sets of probing data from an internal monitoring tool which represent the availability of different services (databases, webservices and so on). Now my task is to visualize this data and I ...
1
vote
0answers
220 views

Single write, multiple read of stateful objects

Scenario: One data input feed (call this Source) Multiple objects (call these Layer1) read this Source, and analyze the feed. This analysis is stateful. Layer1 objects have configuration parameters. ...
1
vote
2answers
546 views

Decimal to 17-bit 2's Complement Signed Number

I am trying to convert decimals, (0.05, -0.28, 25.00, etc), to a 17-bit 2's complement Signed Number. The parameter data I am sending is SysEX Midi Data (to some external Synthesizer). The data ...
7
votes
4answers
3k views

Threads or ThreadPool? Fixed or Dynamic ThreadPool?

I have a java program which listens on a port for input. Based on Input, it calls a webservice and then returns a success/failure back to the client program. I fork a thread for each client ...
1
vote
5answers
993 views

The need for adding an interface to every class [duplicate]

My coworker and I are arguing very hard about this topic. He's thinking that every single class should have an Interface that the class implements (also Single-Implementations). He uses this design ...
1
vote
1answer
4k views

Why does gmail use java? Is there really a advantage over something like php or python? [closed]

Note: I know that none of you (probably) work for google, so this is a lot more of a conceptual question. So yeah, i discovered that Gmail uses java and that got me thinking, Why? I personally never ...
0
votes
1answer
164 views

Controller JSP - no view

Most people say do not use JSPs. But what if I have a JSP that does not show anything, it only acts as a controller? Why would I do that? Because we do not need to redeploy complete webapp to make a ...
0
votes
1answer
589 views

Abstract methods being used as static methods in java?

In an attempt to write some generic code I find myself putting, in my abstract class, a method that returns some static information about how the class should be treated. This method doesn't use any ...
3
votes
1answer
632 views

Is it possible to write a code without class methods, globals, and class variables? [closed]

I'm designing my own programming language for fun, and I'm thinking of making it fully Object-oriented (no statics, no globals, no class variables, no class methods), so I need to find a way to ...
1
vote
1answer
407 views

Custom Alphabetic Sorting of Array in Java

I have a requirement to read a text file with lines in tag=value format and then output the file with specific tags listed first and the rest sorted alphabetically. The incoming file is randomly ...
1
vote
1answer
479 views

Decrement operator difference between C++ and Java? [closed]

Please tell me why the same piece of code behaves differently in C++ and JAVA. Ok first I implement a function to calculate the factorial of an Int RECURSIVELY In JAVA: int f(int x) { ...
5
votes
3answers
553 views

Looking for a freeware NoSql key-value database to offload a Java HashMap [closed]

I have a Java HashMap with a String key and POJO value in a long-running application, and it's taking up a large chunk of memory (over 500mb, and this number is expected to grow - I'm guesstimating ...
0
votes
1answer
225 views

Did I answer this correctly and concisely? [closed]

By email I just answered my brother who is learning computer programming that C++ and Java are more similar than C and C++ even though C++ is nearly a superset of C. Do you agree? AFAIK Stanley ...
7
votes
3answers
759 views

Refactoring an existing abstract class and its parameters

I have an abstract class A which declares an abstract method doStuff. Currently there are many classes that inherit from A and implement doStuff. The class' instances are initialized at run-time ...
1
vote
2answers
466 views

Shift bytes through a fixed sized buffer

I'm writing an InputStream that processes data streams containing "trailer" data. That is, the final n bytes of the stream is a piece of data that must be handled separately and shouldn't be returned ...
1
vote
1answer
130 views

Does JMF have support with Xuggler

i am working on a project consisting of sending and receiving streaming multimedia.So,i have installed JMF, but i have seen that JMF has 32 bit library as mine is 64 bit so i wanted to use Xuggler for ...
-1
votes
3answers
103 views

Best way to create draw with limitation

I'm writing a program to automatically make the draw for a competition. There are four objects: Debate Judge School Team Each Debate has two teams and a judge. Each team participates in three debates. ...
3
votes
3answers
387 views

Is there a way to use a higher level language in a competition that only has C, C++ and Java by default? [closed]

On that competition, you gain access to a system with gcc, vim, emacs and Java. You can't take any file with you and there's no internet access, but you can do whatever you want inside that system. ...
0
votes
1answer
1k views

How to design an application that read files using MVC pattern?

I am going to write an application that reads data from a csv file, and display that data to the user. I intend to apply an MVC design pattern to create this application. A user will interact with ...
1
vote
2answers
313 views

I am new to programming and I am interested in jdbc - Tips and Advice needed [closed]

I am currently acquiring my associates degree in software engineering. I have been told in order to be successful in a computer science field you have to specialized in something. After researching ...
1
vote
2answers
2k views

Type parameterized methods to avoid casting

In a library I am developing I have a factory method that looks a bit like: public <T> T instantiate(Type targetType) { return ...; } I am using a type parameterized method to avoid that ...
28
votes
8answers
5k views

Is the algorithm more important than the programming language?

During the current (2013) Google Code Jam contest, there was a problem that took C++ and Java people 200+ lines of code as compared to Python people that solved the same problem only using 40 lines of ...
4
votes
3answers
2k views

HTML code in Java class

A conceptual question, I tried to google but couldn't find any definitive answers, so here it goes: Is it a good practice to write Java methods to return HTML strings that will be returned to the ...
4
votes
1answer
385 views

Getting into Guava

So I recently started using Netty for my applications client/server communication and I discovered I loved the idea of listenable Futures. I wondered why I didn't know about Java being able to do ...
3
votes
3answers
566 views

Dynamically change of UI on value changes in list box

I have a list box with several elements, let it be web servers (tomcat, iis etc). For each list box value, UI must have different views. For example, if we choose IIS, user name and password fields ...
3
votes
1answer
4k 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 ...
1
vote
2answers
277 views

Load Balancing for Listeners

How should we load balance listeners to a 3rd party service? e.g. We need to read gtalk messages via XMPP Listener and build an application using the interactions of the user with a chatbot. In such ...
8
votes
5answers
867 views

Why does Java use so many middlemen? [closed]

For example to read data from a website we do: HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = ...
0
votes
1answer
2k views

Converting Java applet to web application

I would like to convert this Java applet into an equivalent web app. This is my first time creating a web app, but I have some programming experience and time, and am willing to teach myself all of ...
3
votes
1answer
1k views

Is MVC the optimal pattern to build a RESTful web service?

Not being a Java practitioner, I recently came to learn about the JAX-RS specification and Apache CXF framework. While still wrapping my head around all these things, I also read the this question on ...
0
votes
2answers
888 views

Designing application flow

I am creating a web application in java where I need to mock the following flow. When user trigger a certain process (add product to cart), I need to pass through following steps Need to see in ...
0
votes
1answer
336 views

Teaching `class`es and objects in C++ to university students

To learn classes and objects at my university, students are required to develop a simple game (nine-mens morris or something similar) using Java. Java is used because of its libraries and tool ...