本文整理汇总了Java中gnu.trove.map.hash.THashMap.keySet方法的典型用法代码示例。如果您正苦于以下问题:Java THashMap.keySet方法的具体用法?Java THashMap.keySet怎么用?Java THashMap.keySet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.map.hash.THashMap
的用法示例。
在下文中一共展示了THashMap.keySet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeMetaData
import gnu.trove.map.hash.THashMap; //导入方法依赖的package包/类
protected static final void writeMetaData(File resultFile, THashMap<String, String> cmdLine) {
StringBuilder metaDataLineBuilder = new StringBuilder();
for (String optionKey : cmdLine.keySet()) {
if (cmdLine.get(optionKey) != null) {
metaDataLineBuilder.append(String.format("# %s :\t%s\n", optionKey, cmdLine.get(optionKey)));
System.out.print(String.format("# %s :\t%s\n", optionKey, cmdLine.get(optionKey)));
} else {
metaDataLineBuilder.append(String.format("# %s :\t%s\n", optionKey, "true"));
System.out.print(String.format("# %s :\t%s\n", optionKey, "true"));
}
}
metaDataLineBuilder.append("#Filename\t#Rows\t#Columns\tTime\t#Deps\t#<2Deps\t#<3Deps\t#<4Deps\t#<5Deps\t#<6Deps\t#>5Deps\t#Partitions\n");
System.out.println("#Filename\t#Rows\t#Columns\tTime\t#Deps\t#<2Deps\t#<3Deps\t#<4Deps\t#<5Deps\t#<6Deps\t#>5Deps\t#Partitions\n");
try {
BufferedWriter resultFileWriter = new BufferedWriter(new FileWriter(resultFile));
resultFileWriter.write(metaDataLineBuilder.toString());
resultFileWriter.close();
} catch (IOException e) {
System.out.println("Couldn't write meta data.");
}
}
示例2: tokenize
import gnu.trove.map.hash.THashMap; //导入方法依赖的package包/类
private void tokenize(){
try{
BufferedWriter br = new BufferedWriter(new FileWriter("metadata_string_1"));
ItemFileManager itemReader = new ItemFileManager(items_file, ItemFileManager.READ);
ArrayList<String> items_id = new ArrayList<String>(itemReader.getKeysIndex());
THashMap<String, TIntIntHashMap> branches = null;
ItemTree item = null;
StringBuffer str = null;
for(String item_id : items_id){
item = itemReader.read(item_id);
branches = item.getBranches();
logger.info("Convert " + item_id);
str = new StringBuffer();
str.append(item_id + "\t");
for(String s : branches.keySet()){
String prop = "";
String[] prop_vals = s.split("-");
if(prop_vals.length==1){
for(String ss: prop_vals){
String[] p = props_index.get(Integer.parseInt(ss)).split("/");
prop += p[p.length-1] + "--";
}
for(int f : branches.get(s).keys()){
String[] lbl = metadata_index.get(f).split("/");
str.append(prop + lbl[lbl.length-1].replaceAll("[{'.,;:/}]", "_") + ":" + branches.get(s).get(f) + " ");
}
}
}
br.append(str);
br.newLine();
}
br.flush();
br.close();
itemReader.close();
}
catch(Exception e){
e.printStackTrace();
}
}