Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #10219

Delete slot in the middle of an array and shift remaining

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail
From Svenfischer2@email.com (Sven Fischer)
Newsgroups comp.lang.java.programmer
Subject Delete slot in the middle of an array and shift remaining
Followup-To comp.lang.java.programmer
Date 25 Nov 2011 10:39:52 GMT
Lines 24
Message-ID <4ecf7078$0$6582$9b4e6d93@newsspool3.arcor-online.net> (permalink)
Organization Arcor
NNTP-Posting-Date 25 Nov 2011 11:39:52 CET
NNTP-Posting-Host df79d459.newsspool3.arcor-online.net
X-Trace DXC=[UK>nNko1I8kUFX=Y?aLP;McF=Q^Z^V384Fo<]lROoR18kF<OcfhCO;k4F4_Ui<0f>QL4QcO2CM419AW^;nKDM<?0iX8<ZV`;Z:CMCHMPR`[:>
X-Complaints-To usenet-abuse@arcor.de
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10219

Followups directed to: comp.lang.java.programmer

Show key headers only | View raw


Assume I have an array of strings like

String[] slot = new String[];

slot[0] = new String(first");
slot[1] = new String(second");
slot[2] = new String(third");
slot[3] = new String(foo");
slot[4] = new String("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");

How can I do this most easily?
Is this possible without iteration in a "while" loop?

Sven

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Delete slot in the middle of an array and shift remaining Svenfischer2@email.com (Sven Fischer) - 2011-11-25 10:39 +0000
  Re: Delete slot in the middle of an array and shift remaining Lew <lewbloch@gmail.com> - 2011-11-25 03:21 -0800
    Re: Delete slot in the middle of an array and shift remaining Magnus Warker <magnux@mailinator.com> - 2011-11-25 18:44 +0100
      Re: Delete slot in the middle of an array and shift remaining Lew <lewbloch@gmail.com> - 2011-11-25 09:55 -0800
        Re: Delete slot in the middle of an array and shift remaining Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 21:22 -0500
          Re: Delete slot in the middle of an array and shift remaining Sven Fischer <svenfischer2@email.com> - 2011-11-26 13:48 +0100
            Re: Delete slot in the middle of an array and shift remaining Gene Wirchenko <genew@ocis.net> - 2011-11-26 21:25 -0800
      Re: Delete slot in the middle of an array and shift remaining Patricia Shanahan <pats@acm.org> - 2011-11-25 10:17 -0800
        Re: Delete slot in the middle of an array and shift remaining markspace <-@.> - 2011-11-25 10:24 -0800
        Re: Delete slot in the middle of an array and shift remaining Lew <lewbloch@gmail.com> - 2011-11-25 11:26 -0800
          Re: Delete slot in the middle of an array and shift remaining Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 21:17 -0500
        Re: Delete slot in the middle of an array and shift remaining Roedy Green <see_website@mindprod.com.invalid> - 2011-11-25 14:15 -0800
  Re: Delete slot in the middle of an array and shift remaining Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-25 08:08 -0500
  Re: Delete slot in the middle of an array and shift remaining markspace <-@.> - 2011-11-25 07:39 -0800
  Re: Delete slot in the middle of an array and shift remaining Roedy Green <see_website@mindprod.com.invalid> - 2011-11-25 13:35 -0800
  Re: Delete slot in the middle of an array and shift remaining Arne Vajhøj <arne@vajhoej.dk> - 2011-11-25 21:16 -0500

csiph-web