Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: Generics ? Date: Sat, 17 Dec 2011 15:13:56 -0500 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <2eOdnXdWwdSD2HHTnZ2dnUVZ_t6dnZ2d@posted.palinacquisition> <_5Sdnag2-IwDc3HTnZ2dnUVZ_qqdnZ2d@posted.palinacquisition> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 17 Dec 2011 20:14:02 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="HSlJAUb3pGXi3i7ZL/HoAw"; logging-data="15743"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6Ke3Gh0dMzFUkMSP42ucF" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: Cancel-Lock: sha1:+IO+5EWu1cxKMKpVGvz83J2tYbE= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10839 On 12/17/2011 2:40 PM, Knute Johnson wrote: >[...] > Thanks Pete. That's obvious now but wasn't yesterday :-). You know I > looked all over the net for examples of extending a generic class and > found none. It could be that I didn't know what I was looking for really. Next time something of this sort arises, it may be helpful to ask "Does Java itself provide an example of what I'm trying to do?" In the case at hand, you might have found ArrayList extends AbstractList implements List ... AbstractList extends AbstractCollection ... AbstractCollection implements Collection ... ... illustrating how a generic class can extend a generic class and/or implement a generic interface. The wrong thing to do with the Java source is to ask "If a JFoo has multiple FooListeners, which is the first to be sent a FooEvent?" because that's the sort of implementation detail that might change without notice. But one of the right things to do with Java source is to look at the JFoo implementation to see how it dispatches to the FooListeners, so you can use that pattern as an example when writing the Knute class to dispatch KnuteEvents to KnuteListeners. -- Eric Sosman esosman@ieee-dot-org.invalid