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


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

Re: abbreviated generic syntax

Date 2013-02-18 12:58 +0200
From Donkey Hottie <donkey@fredriksson.dy.fi>
Newsgroups comp.lang.java.programmer
Subject Re: abbreviated generic syntax
References <0h93i8pcopf17145fus96g7vams86hocat@4ax.com> <see-70209E.22410018022013@news.eternal-september.org>
Message-ID <e3e9v9-ho5.ln1@tempest.fredriksson.dy.fi> (permalink)

Show all headers | View raw


18.02.2013 11:41, Barb Knox kirjoitti:
> In article <0h93i8pcopf17145fus96g7vams86hocat@4ax.com>,
>  Roedy Green <see_website@mindprod.com.invalid> wrote:
> 
>> In generics in Java 1.7 you can abbreviate
>>
>>    ArrayList<String> a = new ArrayList<String>( 100 );
>>
>> as
>>
>>    ArrayList<String> a = new ArrayList<>( 100 );
>>
>> Would any code have broken if you abbreviated like this instead:
>>
>>    ArrayList<String> a = new ArrayList( 100 );
>>
>> If not, why the <>?
> 
> I expect that a "new ArrayList(100)" returns an ArrayList of Objects.
> 

It has an storage arrangement for 100 object references (and Strings ARE
Objects), but it does not allocate any Objecs nor Strings in that
initialization.

-- 

You will pass away very quickly.

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


Thread

abbreviated generic syntax Roedy Green <see_website@mindprod.com.invalid> - 2013-02-17 20:26 -0800
  Re: abbreviated generic syntax Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-02-18 01:02 -0800
  Re: abbreviated generic syntax Barb Knox <see@sig.below> - 2013-02-18 22:41 +1300
    Re: abbreviated generic syntax Donkey Hottie <donkey@fredriksson.dy.fi> - 2013-02-18 12:58 +0200
    Re: abbreviated generic syntax Arne Vajhoej <arne@vajhoej.dk> - 2013-02-18 07:20 -0500
      Re: abbreviated generic syntax Arne Vajhoej <arne@vajhoej.dk> - 2013-02-18 07:27 -0500
  Re: abbreviated generic syntax Arne Vajhoej <arne@vajhoej.dk> - 2013-02-18 07:23 -0500
  Re: abbreviated generic syntax "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2013-02-18 19:33 +0000
  Re: abbreviated generic syntax BGB <cr88192@hotmail.com> - 2013-02-18 13:46 -0600
  Re: abbreviated generic syntax Lew <lewbloch@gmail.com> - 2013-02-18 12:29 -0800
    Re: abbreviated generic syntax Robert Klemme <shortcutter@googlemail.com> - 2013-02-18 22:49 +0100
      Re: abbreviated generic syntax Lew <lewbloch@gmail.com> - 2013-02-18 13:51 -0800
    Re: abbreviated generic syntax Roedy Green <see_website@mindprod.com.invalid> - 2013-02-18 15:35 -0800
      Re: abbreviated generic syntax lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-19 08:56 +0000
        Re: abbreviated generic syntax lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-19 12:30 +0000
      Re: abbreviated generic syntax Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-02-19 16:21 +0000
      Re: abbreviated generic syntax Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2013-02-19 11:38 -0600
      Re: abbreviated generic syntax Arne Vajhoej <arne@vajhoej.dk> - 2013-02-19 12:45 -0500
        Re: abbreviated generic syntax BGB <cr88192@hotmail.com> - 2013-02-19 15:20 -0600

csiph-web