java.util.HashMap#toString ( )源码实例Demo

下面列出了java.util.HashMap#toString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: syncer   文件: SQLMapperTest.java
@Test
public void replacePlaceholders() throws Exception {
  HashMap<String, Object> map = new HashMap<>();
  map.put("1", 1);
  map.put("2", 1);
  map.put("3", 3);
  map.put("4", 4);
  map.put("5", -1);
  String s = map.toString();
  Assert.assertEquals(ParameterReplace.orderedParam("(?0)", s.substring(1, s.length() - 1)),
      "(1=1, 2=1, 3=3, 4=4, 5=-1)");
  String key = map.keySet().toString();
  String value = map.values().toString();
  Assert.assertEquals(ParameterReplace.orderedParam("(?0), (?1)",
      key.substring(1, key.length() - 1), value.substring(1, value.length() - 1)), "(1, 2, 3, 4, 5), (1, 1, 3, 4, -1)");
}
 
源代码2 项目: ASTRAL   文件: SpeciesMapper.java
public String getSpeciesNames() {
    if (this.taxonIdToSpeciesId.length == this.speciesNameIdMap.taxonCount()) {
        return Arrays.toString(this.speciesNameIdMap.getAllTaxonNames());
    } else {
        HashMap<String, String> stToGtNameMap = new HashMap<String, String>();
        int i = 0;
        for (List<Integer> set : this.speciesIdtoTaxonId) {
            ArrayList<String> gtNames = new ArrayList<String>();
            for (Integer gi : set) {
                gtNames.add(GlobalMaps.taxonIdentifier.getTaxonName(gi));
            }
            stToGtNameMap.put(this.getSpeciesName(i++), gtNames.toString());
        }
        return stToGtNameMap.toString();
    }
}
 
源代码3 项目: galaxy-sdk-java   文件: BaseClient.java
protected HttpUriRequest prepareRequestMethod(URI uri, HttpMethod method, ContentType contentType,
    HashMap<String, String> params, Map<String, List<Object>> headers, HttpEntity requestEntity)
    throws IOException {
  if (params != null) {
    URIBuilder builder = new URIBuilder(uri);
    for (Entry<String, String> param : params.entrySet()) {
      builder.addParameter(param.getKey(), param.getValue());
    }
    try {
      uri = builder.build();
    } catch (URISyntaxException e) {
      throw new IOException("Invalid param: " + params.toString(), e);
    }
  }

  Map<String, Object> h = prepareRequestHeader(uri, method, contentType);
  headers = mergeToHeaders(headers, h);
  return createHttpRequest(uri, method, headers, requestEntity);
}
 
源代码4 项目: j2objc   文件: HashMapTest.java
/**
 * java.util.AbstractMap#toString()
 */
public void test_toString() {

    HashMap m = new HashMap();
    m.put(m, m);
    String result = m.toString();
    assertTrue("should contain self ref", result.indexOf("(this") > -1);
}
 
源代码5 项目: android_viewtracker   文件: DemoDataCommitImpl.java
@Override
public void commitClickEvent(HashMap<String, Object> commonInfo, String viewName, HashMap<String, Object> viewData) {
    String extra = viewData == null ? "" : "  extra=" + viewData.toString();
    Log.i(TAG, "commitClickEvent: viewName=" + viewName + extra);
}
 
源代码6 项目: android_viewtracker   文件: DemoDataCommitImpl.java
@Override
public void commitExposureEvent(HashMap<String, Object> commonInfo, String viewName, HashMap<String, Object> viewData, long exposureData, HashMap<String, Object> exposureIndex) {
    String extra = viewData == null ? "" : "  extra=" + viewData.toString();
    Log.i(TAG, "commitExposureEvent: viewName=" + viewName + " exposureTime=" + exposureData + extra);
}
 
源代码7 项目: AndroidLinkup   文件: ContactEntry.java
public String toString() {
	HashMap<String, Object> map = new HashMap<String, Object>();
	map.put(key, value);
	return map.toString();
}