This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit bed195a8206703ebefe63cdf52eb66d1557a1caf Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Feb 26 14:17:28 2015 +0100 Récupération via cherry-pick, dans WaoUtils, de la méthode permettant de déduire le mois sur lequel compter le contact ObsMer --- .../src/main/java/fr/ifremer/wao/WaoUtils.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java index 0f6a1ce..0c1ebfd 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java @@ -274,4 +274,21 @@ public class WaoUtils { } }; } + + /** + * Retourne la clé qui a la plus grande valeur, en présences des valeurs égales, on privilégie + * les premières clés trouvées. + */ + public static <T> T getKeyWithHighestValue(Map<T, Integer> map) { + T keyWithHighestValue = null; + int maxObservationDays = 0; + for (Map.Entry<T, Integer> entry : map.entrySet()) { + T aKey = entry.getKey(); + Integer aObservationDays = entry.getValue(); + if (aObservationDays > maxObservationDays) { + keyWithHighestValue = aKey; + } + } + return keyWithHighestValue; + } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.