Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #14161
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Help with program |
| References | (3 earlier) <LsadnfXeh_Mmqz3SnZ2dnUVZ_r6dnZ2d@earthlink.com> <swap-20120501220208@ram.dialup.fu-berlin.de> <4fa07709$0$293$14726298@news.sunsite.dk> <mU_nr.181146$s82.80514@newsfe10.iad> <4fa19850$0$292$14726298@news.sunsite.dk> |
| Message-ID | <Zwior.21918$em4.14907@newsfe21.iad> (permalink) |
| Date | 2012-05-02 15:27 -0700 |
On 5/2/12 1:25 PM, Arne Vajhøj wrote:
> On 5/1/2012 8:06 PM, Daniel Pitts wrote:
>> On 5/1/12 4:51 PM, Arne Vajhøj wrote:
>>> On 5/1/2012 4:21 PM, Stefan Ram wrote:
>>>> Patricia Shanahan<pats@acm.org> writes:
>>>>>> For extra challenge, try doing it without any temporary/local
>>>>>> variables.
>>>>> I strongly recommend against this, in favor of doing it as simply,
>>>>> cleanly and directly as possible.
>>>>
>>>> What could be more clean and direct than
>>>>
>>>> java.util.Collections.swap( java.util.Arrays.asList( a ), i, j )
>>>>
>>>> (assuming »a« has base type Integer[ as given in the OP])?
>>>
>>> It would be cleaner with an import!
>>>
>>> :-)
>
>> static import java.util.Collections.swap;
>> static import java.util.Arrays.asList;
>>
>> (boilerplate code here, that OP must attempt himself)
>> {
>> swap(asList(a), i, j);
>> }
>
> I may just have used the traditional import, but ...
>
> Arne
>
>
Indeed, I was intentionally obfuscating it so that any decent instructor
would know this was plagiarized.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help with program mbuenik5@yahoo.com - 2012-05-01 10:31 -0700
Re: Help with program Patricia Shanahan <pats@acm.org> - 2012-05-01 10:53 -0700
Re: Help with program glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-05-01 19:12 +0000
Re: Help with program Patricia Shanahan <pats@acm.org> - 2012-05-01 12:17 -0700
Re: Help with program Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-01 15:27 -0500
Re: Help with program Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-01 15:32 -0500
Re: Help with program Arne Vajhøj <arne@vajhoej.dk> - 2012-05-01 19:51 -0400
Re: Help with program Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-01 17:06 -0700
Re: Help with program Patricia Shanahan <pats@acm.org> - 2012-05-01 18:08 -0700
Re: Help with program Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-02 12:53 -0700
Re: Help with program Arne Vajhøj <arne@vajhoej.dk> - 2012-05-02 16:25 -0400
Re: Help with program Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-02 15:27 -0700
Re: Help with program Tsukino Usagi <usagi@tsukino.ca> - 2012-05-02 03:15 +0900
Re: Help with program markspace <-@.> - 2012-05-01 11:25 -0700
Re: Help with program Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-05-01 11:16 -0700
Re: Help with program markspace <-@.> - 2012-05-01 11:16 -0700
Re: Help with program rossum <rossum48@coldmail.com> - 2012-05-01 20:41 +0100
Re: Help with program Roedy Green <see_website@mindprod.com.invalid> - 2012-05-01 18:15 -0700
csiph-web