Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #6779
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Chris Riesbeck <Chris.Riesbeck@gmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: looping through a list, starting at 1 |
| Date | Wed, 03 Aug 2011 13:34:42 -0500 |
| Lines | 24 |
| Message-ID | <99tim3Fb7jU1@mid.individual.net> (permalink) |
| References | <list-20110802003845@ram.dialup.fu-berlin.de> <j17l8r$1p2$1@dont-email.me> <99r22jF3t1U1@mid.individual.net> <j19kdf$1aj$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net VMWdjt0KVy2Q7KdVd0mGnQTU3Py6yx6np5d2nTIgdMNyBf/kEv |
| Cancel-Lock | sha1:9xSzMqgqtmLtGZt3LF/9tyai3MQ= |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
| In-Reply-To | <j19kdf$1aj$1@dont-email.me> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6779 |
Show key headers only | View raw
On 8/2/2011 2:50 PM, markspace wrote:
> On 8/2/2011 12:38 PM, Chris Riesbeck wrote:
>
>> import static utils.Tail.tail;
>>
>> for (final E e : tail( list )) {
>> ...
>> }
>
>
> I like the static factory idea, but why define a whole new class?
>
> public class CollectionUtils {
>
> public static <T> List<T> skip( int n, List<T> list ) {
> return list.sublist( n, list.size() ) ;
> }
>
> public static <T> List<T> skip( List<T> list ) {
> return skip( 1, list ) ;
> }
Just generality ... Tail.tail() only requires something that's Iterable,
not a List.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar
Re: looping through a list, starting at 1 Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-01 21:50 -0400
Re: looping through a list, starting at 1 Patricia Shanahan <pats@acm.org> - 2011-08-01 20:34 -0700
Re: looping through a list, starting at 1 Patricia Shanahan <pats@acm.org> - 2011-08-01 20:35 -0700
Re: looping through a list, starting at 1 Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-02 07:31 -0400
Re: looping through a list, starting at 1 Chris Riesbeck <Chris.Riesbeck@gmail.com> - 2011-08-02 14:38 -0500
Re: looping through a list, starting at 1 markspace <-@.> - 2011-08-02 12:50 -0700
Re: looping through a list, starting at 1 Chris Riesbeck <Chris.Riesbeck@gmail.com> - 2011-08-03 13:34 -0500
csiph-web