Chandra shekar M wrote:
Dattaprasad Bhangle wrote:
but method local inner classes will not vanish like all other local variables when method execution completes...
A local class is a nested class (§8) that is not a member of any class and that has a name. (...) The scope of a local class declared in a block is the rest of the immediately enclosing block, including its own class declaration. (...) It is a compile-time error if a local class declaration contains any one of the following access modifiers: coderanch, protected, private, or static.
O. Ziggy wrote:
I thought the compiler warnings will only appear if you mix generic code with non-generic code.
Dorothy Taylor wrote:So if we need to sort these Person objects based on the natural ordering of each person’s complete name, then is it ok to just extend Comparator interface and implement the compare() method?
The map is sorted according to the natural ordering of its keys, or by a Comparator provided at map creation time, depending on which constructor is used.