Skip to content

Instantly share code, notes, and snippets.

@tmahesh
Created May 18, 2012 02:35
Show Gist options
  • Save tmahesh/2722826 to your computer and use it in GitHub Desktop.
Save tmahesh/2722826 to your computer and use it in GitHub Desktop.
is there a memory impact?
Option 1:
@Component
public class RewriteQueryDictionary {
public RewriteQueryDictionary(){
MapDictionary<String> dictionary = new MapDictionary<String>();
initializeFileKeywordsDictionary(dictionary);
//more code here
}
private boolean initializeFileKeywordsDictionary(MapDictionary<String> dictionary) {
while(big loop){
dictionary.addEntry(new DictionaryEntry<String>(keyword, type, CHUNK_SCORE));
}
}
}
Option 2:
@Component
public class RewriteQueryDictionary {
MapDictionary<String> dictionary = new MapDictionary<String>();
public RewriteQueryDictionary(){
initializeFileKeywordsDictionary(dictionary);
//more code here
}
private boolean initializeFileKeywordsDictionary(MapDictionary<String> dictionary) {
while(big loop){
dictionary.addEntry(new DictionaryEntry<String>(keyword, type, CHUNK_SCORE));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment