From: Tom Anderson on
On Fri, 23 Apr 2010, Mike Schilling wrote:

> laredotornado wrote:
>> On Apr 23, 9:15 am, Roedy Green <see_webs...(a)mindprod.com.invalid>
>> wrote:
>>> On Fri, 23 Apr 2010 06:51:15 -0700 (PDT), laredotornado
>>> <laredotorn...(a)zipmail.com> wrote, quoted or indirectly quoted someone
>>> who said :
>>>
>>>> Does anyone know how to sort a map.entrySet by the value? Each entry
>>>> is an Integer mapped to a String, but I wish to have the whole thing
>>>> sorted alphabetically by the strings.
>
> A SortedMap (like TreeMap) is sorted by keys, not values. (And you said
> earlier that the keys are Integers, but here they're Strings, so I'm
> confused.)

Somewhere in the middle of the horror, he's doing:

map.put(((Integer) promoEntryTypes[i].get("id")).toString(), ...

So they're integers, but encoded in what we call 'ASCII-coded decimal'.

tom

--
Per Dementia ad Astra
From: laredotornado on
On Apr 23, 11:59 am, Tom Anderson <t...(a)urchin.earth.li> wrote:
> On Fri, 23 Apr 2010, Mike Schilling wrote:
> > laredotornado wrote:
> >> On Apr 23, 9:15 am, Roedy Green <see_webs...(a)mindprod.com.invalid>
> >> wrote:
> >>> On Fri, 23 Apr 2010 06:51:15 -0700 (PDT), laredotornado
> >>> <laredotorn...(a)zipmail.com> wrote, quoted or indirectly quoted someone
> >>> who said :
>
> >>>> Does anyone know how to sort a map.entrySet by the value? Each entry
> >>>> is an Integer mapped to a String, but I wish to have the whole thing
> >>>> sorted alphabetically by the strings.
>
> > A SortedMap (like TreeMap) is sorted by keys, not values.  (And you said
> > earlier that the keys are Integers, but here they're Strings, so I'm
> > confused.)
>
> Somewhere in the middle of the horror, he's doing:
>
> map.put(((Integer) promoEntryTypes[i].get("id")).toString(), ...
>
> So they're integers, but encoded in what we call 'ASCII-coded decimal'.
>
> tom
>
> --
> Per Dementia ad Astra

Omg, Tom, can I buy you a beer or something? That solution is exactly
what I was looking for. Thanks! - Dave
From: Lew on
laredotornado wrote:
>> tom
>>
>> --
>> Per Dementia ad Astra
>

Don't quote sigs.

> Omg, Tom, can I buy you a beer or something?  That solution is exactly
> what I was looking for.
>

Do I get a beer, too, then?

--
Lew
Don't quote sigs, in particular not this one.
From: Eric Sosman on
On 4/23/2010 2:25 PM, Lew wrote:
> laredotornado wrote:
>>
>> Omg, Tom, can I buy you a beer or something? That solution is exactly
>> what I was looking for.
>>
>
> Do I get a beer, too, then?

Queue<Beer> wall = ...;
assert wall.size() == 99;
while (! wall.isEmpty()) {
System.out.println(wall.size()
+ " bottles of beer on the wall,");
System.out.println(wall.size()
+ " bottles of beer,");
System.out.println("\tYou take one down,");
Beer beer = wall.remove();
System.out.println("\tPass it around,");
lew.consume(beer);
System.out.println(wall.size()
+ " bottles of beer on the wall.\n");
if (! lew.isSober())
throw new IllegalStateException("Lew is looped");
}
assert false; // notreached

--
Eric Sosman
esosman(a)ieee-dot-org.invalid
From: Tom Anderson on
On Fri, 23 Apr 2010, Lew wrote:

> laredotornado wrote:
>
>> Omg, Tom, can I buy you a beer or something? �That solution is exactly
>> what I was looking for.
>
> Do I get a beer, too, then?

U did not post teh codez!!!

> --
> Lew
> Don't quote sigs, in particular not this one.

Use sigdashes, which comprise two dashes followed by a space.

tom

--
CRESS AND CREATIVITY GET BUSY -- Barry