Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed#849#937 #941

Merged
merged 2 commits into from Dec 8, 2016
Merged

Fixed#849#937 #941

merged 2 commits into from Dec 8, 2016

Conversation

wuwen5
Copy link
Contributor

@wuwen5 wuwen5 commented Dec 7, 2016

fix #849 双参数时同样存在内存占用大得问题.

public static <K, V> Map<K, V> parseToMap(String json, 
                                            Class<K> keyType, 
                                            Class<V> valueType) {
     return JSON.parseObject(json, 
                            new TypeReference<Map<K, V>>(keyType, valueType) {
                            });
}

// 可以这样使用
String json = "{1:{name:\"ddd\"},2:{name:\"zzz\"}}";
Map<Integer, Model> map = parseToMap(json, Integer.class, Model.class);
assertEquals("ddd", map.get(1).name);
assertEquals("zzz", map.get(2).name);

视乎 ef50a5b 引入了 #937 问题 ?

@codecov-io
Copy link

codecov-io commented Dec 7, 2016

Current coverage is 91.43% (diff: 72.72%)

Merging #941 into master will decrease coverage by <.01%

@@             master       #941   diff @@
==========================================
  Files           114        114          
  Lines         16720      16713     -7   
  Methods           0          0          
  Messages          0          0          
  Branches       3926       3926          
==========================================
- Hits          15289      15282     -7   
+ Misses          700        693     -7   
- Partials        731        738     +7   

Powered by Codecov. Last update a0a2f8f...e1e49f6

@wenshao wenshao merged commit c3ea528 into alibaba:master Dec 8, 2016
asa1997 pushed a commit to Be-Secure/fastjson that referenced this pull request Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IdentityHashMap占用内存大
3 participants