From owner-freebsd-questions@FreeBSD.ORG Fri Dec 26 18:32:47 2008 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CBD4106564A for ; Fri, 26 Dec 2008 18:32:47 +0000 (UTC) (envelope-from npacemo@gmail.com) Received: from mail-bw0-f19.google.com (mail-bw0-f19.google.com [209.85.218.19]) by mx1.freebsd.org (Postfix) with ESMTP id 47BBA8FC0C for ; Fri, 26 Dec 2008 18:32:46 +0000 (UTC) (envelope-from npacemo@gmail.com) Received: by bwz12 with SMTP id 12so10609772bwz.19 for ; Fri, 26 Dec 2008 10:32:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=6Ydeh7RDKeA9rFLkRiXquL7Uw1hn9aU603GyGaTJdWY=; b=jFkWxJUtYrbl/42MG3CiiOrd8boUV+LkQaxMkFFd71vie85tEyjfBcbPTx0EhTuDkp IGrKroGnKKYUbY/4Iree0N6tcBS0+6xpgoCMwNEZ/5ajqoK/+WXlLXiSTBc51XxoyppB FpqI5QOJ25WrRwF/+UqDQQhSPVELtIzZNFcwg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=lC6coDSDSejXmgqME9Zyf52+H4JZ7pqh8/fY8CBwz+mC7fU34q03m3GIoyR3AFVVhk gAPtB1zY2X0rIUAuajQ56CGImezuZUYAzbgbjyIWc4Xy9SjPpJWRNu4uodfO3MZg8Szi njKVTCi6wZQ5xHD9Wxqymh3syEozLL8GQskHY= Received: by 10.223.107.198 with SMTP id c6mr8337095fap.32.1230314837046; Fri, 26 Dec 2008 10:07:17 -0800 (PST) Received: by 10.223.117.83 with HTTP; Fri, 26 Dec 2008 10:07:16 -0800 (PST) Message-ID: <666bdb140812261007p21b23e13k48d80e4a454ce49e@mail.gmail.com> Date: Fri, 26 Dec 2008 20:07:16 +0200 From: "Vladimir Tsvetkov" To: "Frank Staals" In-Reply-To: <4954E849.6020000@gmx.net> MIME-Version: 1.0 References: <4954E849.6020000@gmx.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: questions@freebsd.org Subject: Re: Off-topic: Java Reflection/Generics/Collections question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Dec 2008 18:32:47 -0000 What you try to do is not a valid operation in type-safe language as Java. You can't convert Coll to Coll, but you can cast Coll to Coll. Don't know if this is OK with the problem you're trying to solve Merry Christmas! On Fri, Dec 26, 2008 at 4:20 PM, Frank Staals wrote: > Not realy a FreeBSD-specific question but I was not sure where I could find > what I was looking for elseware (Googling did not manage to dig up much > info): > > The problem: > > I want to set the type of objects some Collection object holds on runtime. > In other wors I have an object C with: C extends AbstractCollection, I have > the Class object T specifying what type of objects C should hold and I have > a method M which takes a C as an argument. I made a generic version of C > (without the type) and now I have to set it so it can only carry objects of > type T. Does anyone know how to do this ? > > Information in programming style: > > C extends AbstractCollection myCollection; > Class itemType; > > > public void myMethod(C myCollectionArgument) > > How do I convert myCollection from being a C to a C on runtime > so I can call myMethod(myCollection) ? > > I hope the explanation of my problem makes sense and someone can help me. > > Regards, > > > -- > > - Frank > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >