Mathew Kuruvilla

Ranch Hand
+ Follow
since Nov 27, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mathew Kuruvilla

Some combination of the comparing the product of the numbers in addition to the comparing the squares of the two numbers might be good enough.
I didn't think of that earlier. Hope that is good enough ....
5 years ago
I have a tuple class:



I want to override the hashCode method such that it gives a distinct value. However, if num1/num2 are interchanged it should return the same value for the hash code.

example if, if the hash code is n, then when and , the hash code should be n.
BUT
if and then hash code should be m where n!=m

I don't have the brains to find an algorithm to implement this If anybody can give me an algorithm, I would appreciate it.
Thanks.

PS. this is not a student assignment or anything. I was asked this in a job interview question and I still don't have the answer, that is why I am posting it.
5 years ago
Can somebody comment on the implication of accepting a 60 dollars per hour all inclusive in San Jose, California.
How far can that 60 dollars an hour go in living in that city? Will a person living on that income be able to save anything at the end of the day?
Thanks.
5 years ago
Ok. That worked for the example I gave, but the example I gave was something I made up.

What I really want is to access a local variable while iterating a collection.
For example let us say that I have an excel worksheet object and a list object,
for each internal iteration of the list object, I want to add an excel row to the worksheet with the data extracted from the list object for that particular iteration.

I don't want to post the code here as it is kinda long ... that is why I made up the code ...
5 years ago
Uh, I was asking about the variable

It is accessible inside a lambda, but I see no way of accessing it inside the method reference ...
5 years ago
So a method reference has limitations when compared with a lambda expression?
That is to say that a lambda expression is more flexible than a method reference??
5 years ago
How do I access a local variable present in the calling method from a method reference?




The following seem to compile fine:

5 years ago
Thanks all. The Big Moose Saloon still has lots of friendly folks who can answer questions.

6 years ago
Hi All,

I had let eclipse generate some code for me, and I saw this:



I have not yet encountered exceptions being used with the | operator.
Has it always been part of Java or is it a new addition?
If it is a new addition, what feature did it come under.

I just want to read more about it as I don't remember coming across this syntax for my SCJP ,,,

Thanks.
Mathew
6 years ago
Thanks, but I hope that somebody can post a simpler solution to this problem . . . .
Hi,
I have a Stateless Session Bean which does the following:

******Inside the business method*************
boolean entityBeanExists = find an entity bean

if (entityBeanExists == false)
create the entity bean
******************************************

Now, I want above operations to be atomic.
I don't want two simultaneous calls from 2 instances of the Pooled Stateless Bean to execute this code and create two instances of the entity bean.
I only want one entity bean to be created even if the above code is executed simultaneously from two instances of the Stateless Session Bean.
This can be done only if the above code is put into a synchronized block, but since we are not allowed to use the keyword "synchronized" inside EJBs, how can I achieve this effect?

Thanks.
Mathew
Hi,

When we start a java program with the -Xmx=1024m option on a machine with 4GB of RAM, is it possible for the java process to cause a memory leak, such that the entire 4GB is used up? Won't it throw an java.lang.OutOfMemory error, rather than try to allocate memory outside the 1024m limit?

Thanks.
Mathew
11 years ago
After doing a JNDI lookup, narrowing, ejb create etc. I get a reference to a Session bean.
Then I make an invocation on a business method of the Session Bean.
I get a timeout.

Where is this timeout specified? I would like to increase it and retry this scenario.

If anybody has a link which explains client server communication mechanism in detail, please provide it.
thanks.
Hi, I was asked an interview question.
"What is the memory implications if the static member in a Class is not initalized"

I replied that static members are initialized to null. Clearly this was wrong, because
he went on to his next question . . .
11 years ago