Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Delete slot in the middle of an array and shift remaining Date: Fri, 25 Nov 2011 10:24:19 -0800 Organization: A noiseless patient Spider Lines: 27 Message-ID: References: <4ecf7078$0$6582$9b4e6d93@newsspool3.arcor-online.net> <20684688.629.1322220072927.JavaMail.geo-discussion-forums@prnh1> <8-GdnXrqhJJORlLTnZ2dnUVZ_rqdnZ2d@earthlink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 25 Nov 2011 18:24:21 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="31674"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hSdQwJlc+7L28ed5tFgby3Bp4vNrx8kk=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <8-GdnXrqhJJORlLTnZ2dnUVZ_rqdnZ2d@earthlink.com> Cancel-Lock: sha1:KPt6NVWM1lEM2bKYKeABHSlsBso= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10229 It's a bit cleaner this way. On 11/25/2011 10:17 AM, Patricia Shanahan wrote: > > public class ArrayDelete { > > public static void main(String[] args) { > String[] slot = {"first", "second", "third", "foo", "bar" }; > > // Now I want to delete e.g. the third slot and shift all remaining > slots 1 slot upwards. > // > // The result should look like: > // > // slot[0] = new String(first"); > // slot[1] = new String(second"); > // slot[2] = new String(foo"); > // slot[3] = new String("bar"); > } > > } >