From 4de3cf9c2589cf33df02da2068d1c048cae0caea Mon Sep 17 00:00:00 2001 From: dolfinus Date: Mon, 23 Sep 2019 20:57:38 +0300 Subject: [PATCH] Add mergeNotNull to MapUtil class --- src/org/camunda/latera/bss/utils/MapUtil.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/org/camunda/latera/bss/utils/MapUtil.groovy b/src/org/camunda/latera/bss/utils/MapUtil.groovy index ec4297a9..6c8145d5 100644 --- a/src/org/camunda/latera/bss/utils/MapUtil.groovy +++ b/src/org/camunda/latera/bss/utils/MapUtil.groovy @@ -34,6 +34,18 @@ class MapUtil { return (input.keySet() as String[]) } + static Map mergeNotNull(Map first, Map second) { + LinkedHashMap result = [:] + first.each { key, value -> + if (value == null && second[key] != null) { + result[key] = second[key] + } else { + result[key] = value + } + } + return result + } + static Integer keysCount(Map input) { return keysList(input)?.size() ?: 0 }