Mike Stach

Greenhorn
+ Follow
since Oct 26, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mike Stach

Moreover, when you start using frameworks like Spring, you will find simple annotations can make life so much easier that you can avoid writing a lot many helper classes that people write using old-fashioned java.

Annotations are used quite a bit in popular frameworks and I feel they do not make code ugly but more informative.
16 years ago
If you always use the below one:

List<> abc = new ArrayList<>;

you may not be able to take adavantage of the specific implementations that Vector, LinkedList or ArrayList might provide. So when you are exposing your functionalility, it is quite important to use the interface. But inside your method, you might want to use a wrapper to also make use of these implementations accoring to the desired functionality.
16 years ago
Lets say we have collection of 3 objects and we wish to find permutations amongst them. I know there are elegant ways to write this recursively but is there a way to improve the below iterative version?



If I increase or decrease the collection size from 3, I do not want code duplication. I want to come up with a generic way of iteratively finding permutations regardless of the size of collection.
16 years ago
The idea of putting request filter that will intercept the request inside the deployment descriptor (web.xml) file sounds better than 2nd idea.
16 years ago
I agree with what Nitesh is saying. However, I presume the scheduler is trying to poll the database for some state change. Instead of writing a scheduler, you might as well could consider using JMS topics that would send a message to one of the app server instances to carry out the task.
It looks like a sparse matrix will fit the bill well for this requirement.
16 years ago
Is there any standard math library to find permutations? The apache commons math does not find all the permutations. I would like to use some kind of a library that finds all 6P4 permutations.
16 years ago
I have a basic question related to inheritance.
Consider the following code snippet:

public class B {
}

public class D extends class B{
public D(){
super();
}

public static void main(String args[]){
new D();
}
}

My question is whether new D() invocation will create 3 objects i.e. D, B, and top class Object or whether it will create only 1 object i.e. D?

I am confused as to whether inheritance leads to chained object creation or whether the compiler copies all the eligible public and protected members from the base class into the derived class so that base class does not need to be instantiated all the time.

When I see the bytecode, it looks like 3 objects are created because of init() invocations but I just wanted to be sure about it. I would appreciate if someone could comment on it.
16 years ago