| Author |
Which Is Faster: String method or finding tree node
|
Isaac Hewitt
Ranch Hand
Joined: Jul 24, 2006
Posts: 179
|
|
Wanting to know which is faster in JTree. The directory in question is second from the root. You would have this Root/A/Synopsis
The path is this: String path = DocumentTree.this.getLastSelectedPathComponent().toString();
or would it be faster to find out which child it is.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12926
|
|
It's a bit hard to understand what exactly you're asking.
Does your code have a performance problem? If not, then is it really worth it to spend a lot of time on optimizing this?
Note that writing code in the form:
is overly verbose, you could just write:
You could rewrite your method like this:
I would also rename the method to isSynopsisDir instead of just synopsisDir to improve readability.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: Which Is Faster: String method or finding tree node
|
|
|