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


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

Re: Generics ?

From Knute Johnson <nospam@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: Generics ?
Date 2011-12-16 22:01 -0800
Organization A noiseless patient Spider
Message-ID <jchb74$n8m$1@dont-email.me> (permalink)
References <jcem2m$gbm$1@dont-email.me> <ag5me7h7pph1d4n2b05uvgump03dp7ig0t@4ax.com>

Show all headers | View raw


On 12/16/2011 2:10 AM, Roedy Green wrote:
> On Thu, 15 Dec 2011 21:48:06 -0800, Knute Johnson
> <nospam@knutejohnson.com>  wrote, quoted or indirectly quoted someone
> who said :
>
>> public class KList extends JList {
>>      ListModel model = new DefaultListModel();
>
> If you were just using JList by itself you would say:
>
>   final JList<String>  flavour = new JList<String>( new String[] {
>                      "strawberry", "chocolate", "vanilla" } );
>
> Your new class KList can have a built-in fixed contained type, e.g.
> String or it can have a variable one.
>
> The first is pretty obvious :
>
> class KList extends JList<String>
>
> The second you can discover by looking for some similar Sun code in
> src.zip, e.g.
>
> public interface MutableComboBoxModel<E>  extends ComboBoxModel<E>  {
>
> so I would think
>
> KList<E>  extends JList<E>
> should work.
>
> For additional hints, see http://mindprod.com/jgloss/generics.html
> and links
>
> I have not tested this and quite commonly things in generics I think
> should work do not. Take this just as a hint of something to try.

Yeah, unfortunately that doesn't work.  Is it possible to extend JList 
and not get unchecked warnings?

-- 

Knute Johnson

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


Thread

Generics ? Knute Johnson <nospam@knutejohnson.com> - 2011-12-15 21:48 -0800
  Re: Generics ? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-12-15 22:03 -0800
    Re: Generics ? Tassilo Horn <tassilo@member.fsf.org> - 2011-12-16 08:30 +0100
      Re: Generics ? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-12-16 00:08 -0800
  Re: Generics ? Roedy Green <see_website@mindprod.com.invalid> - 2011-12-16 02:10 -0800
    Re: Generics ? Knute Johnson <nospam@knutejohnson.com> - 2011-12-16 22:01 -0800
      Re: Generics ? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-12-16 23:30 -0800
        Re: Generics ? Knute Johnson <nospam@knutejohnson.com> - 2011-12-17 10:20 -0800
          Re: Generics ? markspace <-@.> - 2011-12-17 10:54 -0800
            Re: Generics ? Knute Johnson <nospam@knutejohnson.com> - 2011-12-17 11:25 -0800
              Re: Generics ? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-12-17 21:20 -0800
                Re: Generics ? "Qu0ll" <Qu0llSixFour@gmail.com> - 2011-12-18 21:08 +1100
                Re: Generics ? Lew <lewbloch@gmail.com> - 2011-12-18 08:17 -0800
                Re: Generics ? markspace <-@.> - 2011-12-18 08:43 -0800
          Re: Generics ? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-12-17 11:33 -0800
            Re: Generics ? Knute Johnson <nospam@knutejohnson.com> - 2011-12-17 11:40 -0800
              Re: Generics ? Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-12-17 11:47 -0800
              Re: Generics ? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-17 15:13 -0500
      Re: Generics ? Roedy Green <see_website@mindprod.com.invalid> - 2011-12-17 02:46 -0800
  Re: Generics ? "John B. Matthews" <nospam@nospam.invalid> - 2011-12-17 11:18 -0500
    Re: Generics ? Knute Johnson <nospam@knutejohnson.com> - 2011-12-17 11:16 -0800

csiph-web