{@link Map}值转数组

@param <K> 类型
@param <V> 类型
@param map {@link Map}
@param clazz 类

@return 数组

@since 1.0.8
550066
@SuppressWarnings("unchecked")
    public static <K, V> V[] mapToArray(Map<K, V> map, Class<V> clazz) {
        if (Checker.isNotEmpty(map)) {
            V[] array = (V[]) Array.newInstance(clazz, map.size());
            int i = 0;
            for (V v : map.values()) {
                array[i++] = v;
            }
            return array;
        }
        return null;
    }
1236685
public Map<String, String> getStringMap(final Map<String, String> map) {
		final int len = getVInt();
		for (int i = 0; i < len; i++) {
			map.put(getString(), getString());
		}
		return map;
	}
298623
public static <S, T> Map<S, T> compactAndLockHashMap( HashMap<S, T> map )
  {
    if( map == null || map.isEmpty() )
    {
      return Collections.emptyMap();
    }

    if( map.size() == 1 )
    {
      Map.Entry<S, T> stEntry = map.entrySet().iterator().next();
      return Collections.singletonMap( stEntry.getKey(), stEntry.getValue() );
    }

    Map<S, T> newMap = new HashMap<S, T>( map.size(), 1 );
    newMap.putAll( map );
    return Collections.unmodifiableMap( newMap );
  }
1279921
@SuppressWarnings("unchecked")
  public static <K, V> MultiValueMap<K, V> unmodifiableMultiValueMap(
      final MultiValueMap<? extends K, ? extends V> map) {
    Assert.notNull(map, "'map' must not be null");
    final Map<K, List<V>> result = new LinkedHashMap<>(map.size());
    map.forEach((key, value) -> {
      final List<? extends V> values = Collections.unmodifiableList(value);
      result.put(key, (List<V>) values);
    });
    final Map<K, List<V>> unmodifiableMap = Collections.unmodifiableMap(result);
    return CollectionUtils.toMultiValueMap(unmodifiableMap);
  }
643181
@SuppressWarnings("unchecked")
  public static Map<String, String> toStringMap(Object map) {
    if (map == null) {
      return null;
    }

    if (map instanceof Map) {
      Map<Object, Object> rawMap = (Map<Object, Object>) map;
      Map<String, String> stringMap = new HashMap<>();
      for (Entry<Object, Object> entry : rawMap.entrySet()) {
        stringMap.put(entry.getKey().toString(), entry.getValue().toString());
      }
      return stringMap;
    } else {
      throw new AvroRuntimeException("value must be a map");
    }
  }
607716
public static <K, V> Map<K, V> removeNulls(Map<K, V> map) {
        Map<K, V> result = new LinkedHashMap<>();
        map.forEach((k, v) -> {
            if (v != null) {
                result.put(k, v);
            }
        });
        return result;
    }
744409
public static <K, V, M extends Map<K, V>> UnmodifiableMutableMap<K, V> of(M map)
    {
        if (map == null)
        {
            throw new IllegalArgumentException("cannot create a UnmodifiableMutableMap for null");
        }
        return new UnmodifiableMutableMap<K, V>(MapAdapter.adapt(map));
    }
909658
public static <K, V> EntryStream<K, V> of(Map<K, V> map) {
        return of(map.entrySet().stream());
    }
747967
@SuppressWarnings("unchecked")
	public static <K, V> Map<K, V> getAny(Map<K, V> map, final K... keys) {
		return filter(map, new Filter<Entry<K, V>>() {

			@Override
			public boolean accept(Entry<K, V> entry) {
				return ArrayUtil.contains(keys, entry.getKey());
			}
		});
	}
140460
public Map<String, String> getParametersToMap(Map<String, String> map) {
        if (map == null) map = new LinkedHashMap<>();
        final Map<String, String> map0 = map;
        getParameters().forEach((k, v) -> map0.put(k, v));
        return map0;
    }
1108040
public static <K, V> Map<K, V> toSortedMap(Map<K, V> map, Comparator<? super K> comparator) {
        Map<K, V> sortedMap;
        if (comparator == null)
            sortedMap = new LinkedHashMap<>();
        else
            sortedMap = new TreeMap<>(comparator);
        sortedMap.putAll(map);
        return sortedMap;
    }
347439
@SuppressWarnings("unchecked")
    public <K> K[] getKeys(Map<K, ?> map) {
        K[] result = null;
        Set<K> keySet = map.keySet();
        if (keySet.size() > 0) {
            result = (K[]) keySet.toArray(new Object[keySet.size()]);
        }
        
        return result;
    }
1120493
static <T extends ValueMap> T createValueMap(Map map, Class<T> clazz) {
    try {
      Constructor<T> constructor = clazz.getDeclaredConstructor(Map.class);
      constructor.setAccessible(true);
      return constructor.newInstance(map);
    } catch (Exception e) {
      throw new AssertionError(
          "Could not create instance of " + clazz.getCanonicalName() + ".\n" + e);
    }
  }
412429
public static <K, V> Map<K, V> newMap(Map<K, V> map) {
        return Optional.ofNullable(map).map(HashMap::new)
                .orElseGet(HashMap::new);
    }
928744
public static <K, V> Map<K, V> sortNumberMapByKeyAscending(Map<K, V> map) {
        return sortNumberMapByKeyAscending(map.entrySet());
    }
1289716
public static <K, V> Map<K, V> copy(final Map<K, V> map) {
		if (map == null) {
			return null;
		}

		TypeEnum keyType = null;
		TypeEnum valueType = null;

		Map<K, V> copy = new HashMap<K, V>();
		for (Map.Entry<K, V> entry : map.entrySet()) {
			K key = entry.getKey();
			V value = entry.getValue();

			K keyCopy = null;
			if (key != null) {
				if (keyType == null) {
					keyType = TypeEnum.dataTypeOf(key.getClass());
				}
				keyCopy = copy(key, keyType);
			}

			V valueCopy = null;
			if (value != null) {
				if (valueType == null) {
					valueType = TypeEnum.dataTypeOf(value.getClass());
				}
				valueCopy = copy(value, valueType);
			}

			copy.put(keyCopy, valueCopy);
		}

		return copy;
	}
608394
public static <K, V> Map<K, V> copyOf(Map<K, V> map) {
        Preconditions.checkNotNull(map);
        return ImmutableMap.<K, V> builder().putAll(map).build();
    }