This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

micha koern

+ Follow
since Mar 25, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by micha koern

is it possible to change the session-name (JSESSIONID into NEWSESSIONID) of a webcontainer in the applicationserver (Tomcat 6). I do not want to change the session name of every webcontainer on the appserver - i want to do this for a certain war.

thanks Michael

6 years ago
As you allready mentioned- you are using a anonymous classes.

An anonymous class can either implement an interface or extend a class (not both).
What to do depends on the class/interface you use.
In your case HelloInterface is an Interface so

ist the same as

There is one difference the anonymous class has no Name.

Because of this you are not instantiating the Interface. - You are instantiating the Anonymous class that implements the interface.

But i cant explain why hello should be of Type Test - i think this is a debugger-Problem.

7 years ago
Thank you for the Christmas - Gift :-) .

long time ago i downloaded a really good test called examlab.
The link was . Unfortunately this link doesnt exist anymore.
Does anyone have the installation files and is able to give them to me?

Thanks a lot

Thank you now i understand...

The reference type is ? super Dog, so it can be Dog also.

This helps a lot.

Thank you

i have got a strange problem with Lists.

Animal is a superclass of Dog- because of this i thought the following would be fine.
Why cant i do this:

Why can i do this:

Thanks for your help!


Larsen Raja wrote:Hi,

From my understanding, List based collections are itself not designed to hold unique elements. So there should be no specific method for doing this. Though you implement comparable or comparator, you have no specific implemenation to avoid duplicates. You can implement compareTo method, see if result is 0 and then remove manually which obviously involves for loop.


Thanks for your reply.
Collection-Classes have an addAll()- Method. So it is possible to put all the Elements from a List into a Set.
Now i 'd like to say the compiler: "Hey- take this List and insert each element only one time by this given <Comparator-Thing>"
I know- the comparator it self doesnt work- but which can i take?

A loop is possible for sure, but I thougt there would be a nice/elegant way by using Sets.
8 years ago
i want to eliminate duplicates from a List of certain Objects (for example Instances of the class Person).
The easyest way would be to override equals and hashCode and use a Set.

Now i want to use only some fields of the Person-Instance - for example the last name.
At another place i want to use both - first and last name.

How can i do that? I want to write something like a comparator that i can use to eliminate duplicates from a List.

I know i can do this with for(){} but i think a set would be better.

I hope you understand what i mean - my english isnt the best :-)


- Micha
8 years ago
Its the same -List is just an interface.
You can use both in the same way (perhaps ArrayList has more methods wich you can use).

So if you want it to call it a benefit:

Benefit for Arraylist: you can use each method, that ArrayList offers.
Benefit for List: you can use it everywhere, where just a List is required and allow also other implementations (for example LinkedList).

But remember- an ArrayList is a List so you can treat it also like a List.
Hi- I did it too!!! - I passed the Exam with 95%.
Thanks for your help and the whole forum.
Btw -it isnt so hard as the tests in the Bates-book are- but its good for preparation.

Very usefull is also:

9 years ago
I know, that it works starting with com.
But is there a chance to get it startet with the classes-folder in the jar?

I have got the following Folder-Structure:

As you will guess the Testclass is in the Package

How can I call the Testclass from the classes.jar

A ClassNotFoundException is shown when i call

How can I do this?

Thanks for your help!

Sylvain Bouchard wrote:

This assignment works cause the value 12 is small enough to be hold by a short.
Remember that a short can hold a value from -32768 à 32767.

This Double-Value is also small enough to fit in a float (32 Bit).
But this wont compile.

So there must be something different, that is responsible for this.
i tried the following:

OK this doesnt work, because the double cant be cast to float.

And than i tried this:

This doestn work, because int cant be cast to short.

Than i tried this:

Why does this work? 12 is an integer!

Thanks for your help