The Artima Developer Community
Sponsored Link

Design Forum
performance issues with this code!

1 reply on 1 page. Most recent reply: Dec 25, 2003 6:06 PM by lxpbuaa

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Daniel

Posts: 1
Nickname: danielj
Registered: Nov, 2003

performance issues with this code! Posted: Nov 12, 2003 3:09 AM
Reply to this message Reply
Advertisement
public class CVSTagReader {
public final static String cvsTag;

static {
cvsTag = "$Name: October $".substring(6, "$Name: October $".indexOf("$", 3) - 1).trim().replace('_', '.');
}
}

<%=CVSTagReader.cvsTag%>




public class CVSTagReader {
private static final String rawTag = "$Name: $";

private String tag;
static {
tag = rawTag.substring(6, "$Name: October $".indexOf("$", 3) - 1).trim().replace('_', '.');
}
public String getTag() {
return tag;
}

}

<%=CVSTagReader.getTag()%>

What are the advantages of second over first?

How the memory is allocated and what is called Class, Variables, methods when compared to both?

How can it be more optimized?


lxpbuaa

Posts: 2
Nickname: lxpbuaa
Registered: Dec, 2003

Re: performance issues with this code! Posted: Dec 25, 2003 6:06 PM
Reply to this message Reply
The second gives a encapsulation with private String tag by using function getTag. It's Object-Oriented,but the first isn't.

Flat View: This topic has 1 reply on 1 page
Topic: win32 api Previous Topic   Next Topic Topic: What is a

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use