Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » JDT Core basic question
JDT Core basic question [message #165498] Tue, 22 June 2004 08:36 Go to next message
Eclipse UserFriend
Originally posted by: ptiedt.us.ibm.com

Hi All,

I was wondering why the JDT uses an elementType field instead of doing
instanceof checkings to find out about an elements type?

Philipp
Re: JDT Core basic question [message #165512 is a reply to message #165498] Tue, 22 June 2004 09:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

You can use switch statements if you use element type because those are
constants.

--
Thanks, Rich Kulp

Re: JDT Core basic question [message #165520 is a reply to message #165512] Tue, 22 June 2004 11:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ptiedt.us.ibm.com

Ok,

but is that really the only purpose?
Re: JDT Core basic question [message #165526 is a reply to message #165520] Tue, 22 June 2004 11:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

No, but it makes it easy. It allows for faster testing then a bunch of
instanceof tests. If you are only looking for one kind, then instanceof
may be fine.

ptiedt@us.ibm.com wrote:

> Ok,
>
> but is that really the only purpose?

--
Thanks, Rich Kulp

Re: JDT Core basic question [message #165534 is a reply to message #165520] Tue, 22 June 2004 12:56 Go to previous message
Eclipse UserFriend
Originally posted by: newsserver_mails.bodden.de

ptiedt@us.ibm.com wrote:

> Ok,
>
> but is that really the only purpose?
No, it's also way faster. An instanceof tries to validate the type
against its whole hierarchy. Another option is
<object>.getClass()==AClass. However, this uses reflection, which is
also a bottleneck sometimes.

Eric

--
Eric Bodden
ICQ UIN: 12656220
Website: http://www.bodden.de
GPG: BB465582
Previous Topic:questions about SearchEngine
Next Topic:Minimal set of plugin and feature
Goto Forum:
  


Current Time: Sun May 11 11:38:26 EDT 2025

Powered by FUDForum. Page generated in 0.03847 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top