You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by az...@apache.org on 2019/08/28 09:44:14 UTC

[flink-web] branch asf-site updated: [FLINK-13804][code style][zh] Set the initial capacity for a collection only if there is a good proven reason

This is an automated email from the ASF dual-hosted git repository.

azagrebin pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/flink-web.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new e4f85d6  [FLINK-13804][code style][zh] Set the initial capacity for a collection only if there is a good proven reason
e4f85d6 is described below

commit e4f85d62998c0aaaa8c4acb66604c4235944279a
Author: Andrey Zagrebin <az...@gmail.com>
AuthorDate: Wed Aug 28 11:41:04 2019 +0200

    [FLINK-13804][code style][zh] Set the initial capacity for a collection only if there is a good proven reason
---
 contributing/code-style-and-quality-java.zh.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contributing/code-style-and-quality-java.zh.md b/contributing/code-style-and-quality-java.zh.md
index 335e889..f0de4e7 100644
--- a/contributing/code-style-and-quality-java.zh.md
+++ b/contributing/code-style-and-quality-java.zh.md
@@ -63,6 +63,7 @@ title:  "Apache Flink Code Style and Quality Guide — Java"
     * `contains()` before `get()` → `get()` and check null
     * `contains()` before `put()` → `putIfAbsent()` or `computeIfAbsent()`
     * Iterating over keys, getting values → iterate over `entrySet()`
+* **Set the initial capacity for a collection only if there is a good proven reason** for that, otherwise do not clutter the code. In case of **Maps** it can be even deluding because the Map's load factor effectively reduces the capacity.
 
 
 ### Lambdas