map if null is passed in.
766800
private static Map<Object, Object> toProtoMap(@NullableDecl Object container) {
    if (container == null) {
      return Collections.emptyMap();
    }
    List<?> entryMessages = (List<?>) container;

    Map<Object, Object> retVal = Maps.newHashMap();
    for (Object entry : entryMessages) {
      Message message = (Message) entry;
      Object key = message.getAllFields().get(message.getDescriptorForType().findFieldByNumber(1));
      Object value =
          message.getAllFields().get(message.getDescriptorForType().findFieldByNumber(2));
      retVal.put(key, value);
    }
    return retVal;
  }
401320
void assertNotNull(Object object, String param) {
    if (object == null) {
      throw new IllegalArgumentException(String.format(
          "%s may not be null.", param));
    }
  }
65241
@SuppressWarnings("unchecked")
	private <T> T nullFor(DataType dataType)
	{
		switch(dataType)
		{
			case Long: return (T)Long.valueOf(-1);
			default: return null;
		}
	}
1051894
public void setStringIfNotEmpty(@NotNull final String key, @Nullable final String value) {
        if (null != value && !value.isEmpty()) {
            setString(key, value);
        }
    }
270809
public static <K, V> void validateNotNull(K key, V value) {
        checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED);
        checkNotNull(value, NULL_VALUE_IS_NOT_ALLOWED);
    }
101091
private static void writeMap(Map<?, ?> map, CharBuf buffer) {
        if (!map.isEmpty()) {
            buffer.addChar('{');
            boolean firstItem = true;
            for (Map.Entry<?, ?> entry : map.entrySet()) {
                if (entry.getKey() == null) {
                    throw new IllegalArgumentException("Maps with null keys can\'t be converted to JSON");
                }

                if (!firstItem) {
                    buffer.addChar(',');
                } else {
                    firstItem = false;
                }

                buffer.addJsonFieldName(entry.getKey().toString());
                writeObject(entry.getValue(), buffer);
            }
            buffer.addChar('}');
        } else {
            buffer.addChars(EMPTY_MAP_CHARS);
        }
    }
689661
static boolean safeContainsKey(Map<?, ?> map, Object key) {
    checkNotNull(map);
    try {
      return map.containsKey(key);
    } catch (ClassCastException e) {
      return false;
    } catch (NullPointerException e) {
      return false;
    }
  }
621969
@SuppressWarnings("unchecked")
	public static void execute(Map<String, Object> map, BindMapListener listener) {
		if (listener == null)
			throw (new KriptonRuntimeException("listener can not be null"));
		if (map == null)
			throw (new KriptonRuntimeException("map can not be null"));

		VisitorStatusType status = VisitorStatusType.RUN;

		for (Entry<String, Object> item : map.entrySet()) {
			if (item.getValue() == null || item.getValue() instanceof String) {
				visit(item.getKey(), (String) item.getValue(), listener, status);
			} else if (item.getValue() instanceof List) {
				visitList(item.getKey(), (List<Object>) item.getValue(), listener, status);
			} else if (item.getValue() instanceof Map) {
				visitMap(item.getKey(), (Map<String, Object>) item.getValue(), listener, status);
			}

			if (status == VisitorStatusType.STOP)
				return;

		}

	}
601941
public static String nullIfEmpty(String s) {
      if (s != null && s.length() == 0) {
         return null;
      } else {
         return s;
      }
   }
1338628
@Override
  public void from(Map<KEY, VALUE> map) {
    getMap().putAll(nullSafeMap(map));
  }
315560
private void nullPrintln(PrintStream out, String line)
    {
        if (out != null)
        {
            out.println(line);
        }
    }
628350
public static <K, V> V getOrDefault(final Map<K, V> map, final Object key, final V defaultValue) {
        if (N.isNullOrEmpty(map)) {
            return defaultValue;
        }

        final V val = map.get(key);

        if (val != null || map.containsKey(key)) {
            return val;
        } else {
            return defaultValue;
        }
    }
184856
static String firstNonEmptyValue(String key, Map<?, ?>... maps) {
    for (Map<?, ?> map : maps) {
      String value = (String) map.get(key);
      if (!isEmpty(value)) {
        return value;
      }
    }
    return null;
  }
929275
def get_as_nullable_parameters(self, key):
        
        value = self.get_as_nullable_map(key)
        return Parameters(value) if value != None else None
1200884
public static <T> T getValue(Map<String, Object> map, String key, Class<T> clazz) {
        return map != null ? ValueUtils.convertValue(map.get(key), clazz) : null;
    }
971620
public static <K, V> Map<K, V> cast(Map<?, ?> map) {
    return map == null ? null : new CastingMap<K, V>(map);
  }
852069
public static <K, V> Map<K, List<V>> nullToEmptyMultimap(Map<K, List<V>> newValue) {
    if (newValue == null) {
      return new HashMap<>();
    }
    return newValue;
  }