Creates a map where the object at index N from the first List is the key for the object at index N of the second
List. <br> By default discards both key and value if either one is null.

@param keys   List of keys
@param values List of values
@return map
185523
public static Map zip(List keys, List values) {
        return zip(keys, values, false);
    }
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;
    }
106155
public static <K, V> List<Tuple<K, V>> object(final List<K> keys, final List<V> values) {
        return map(keys, new Function<K, Tuple<K, V>>() {
            private int index;

            @Override
            public Tuple<K, V> apply(K key) {
                return Tuple.create(key, values.get(index++));
            }
        });
    }
670199
@SuppressWarnings("unchecked")
	public static <K, V> ArrayList<V> valuesOfKeys(Map<K, V> map, K... keys) {
		final ArrayList<V> values = new ArrayList<>();
		for (K k : keys) {
			values.add(map.get(k));
		}
		return values;
	}
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());
			}
		});
	}
858156
public static boolean mapContainsKeys(Map<?, ?> _map, Object... _keys) {
        if (_map == null) {
            return false;
        } else if (_keys == null) {
            return true;
        }
        for (Object key : _keys) {
            if (key != null && !_map.containsKey(key)) {
                return false;
            }
        }
        return true;
    }
1031105
private <V> BiMap<V, Integer> createIndex(Set<V> values) {
    if (values == null) {
      return null;
    }

    ImmutableBiMap.Builder<V, Integer> builder = ImmutableBiMap.builder();
    int idx = 0;
    for (V value : values) {
      builder.put(value, idx++);
    }
    return builder.build();
  }
485814
public static <K, V> Map<K, V> zipMapPartial(Iterable<K> keys, Iterable<V> values)
  {
    Map<K, V> retVal = new LinkedHashMap<>();

    Iterator<K> keysIter = keys.iterator();
    Iterator<V> valsIter = values.iterator();

    while (keysIter.hasNext()) {
      final K key = keysIter.next();

      if(valsIter.hasNext()) retVal.put(key, valsIter.next());
      else break;
    }

    return retVal;
  }
383449
public StreamRecord withKeys(java.util.Map<String, AttributeValue> keys) {
        setKeys(keys);
        return this;
    }
559628
public T mapObject(final Map<String, String> values) throws Exception {

        T result = createInstance();

        // for each field
        for (Map.Entry<String, String> entry : values.entrySet()) {

            String field = entry.getKey();
            //get field raw value
            String value = values.get(field);

            Method setter = setters.get(field);
            if (setter == null) {
                LOGGER.warn("No public setter found for field {}, this field will be set to null (if object type) or default value (if primitive type)", field);
                continue;
            }

            Class<?> type = setter.getParameterTypes()[0];
            TypeConverter<String, ?> typeConverter = typeConverters.get(type);
            if (typeConverter == null) {
                LOGGER.warn(
                        "Type conversion not supported for type {}, field {} will be set to null (if object type) or default value (if primitive type)",
                        type, field);
                continue;
            }

            if (value == null) {
                LOGGER.warn("Attempting to convert null to type {} for field {}, this field will be set to null (if object type) or default value (if primitive type)", type, field);
                continue;
            }

            if (value.isEmpty()) {
                LOGGER.debug("Attempting to convert an empty string to type {} for field {}, this field will be ignored", type, field);
                continue;
            }

            convertValue(result, field, value, setter, type, typeConverter);

        }

        return result;
    }
309722
protected static final <T, K extends Serializable>
    List<K> _keys2Ids(
                    final Collection<Key<T>> keys
                    )
    {
        List<K>  ids = new ArrayList<K>();
        if (keys != null ) {
            for (Key<T>  key : keys) {
                @SuppressWarnings( "unchecked" )
                K  id = (K)key.getId();
                ids.add( id );
            }
        }

        return ids;
    }
1299134
public static Map<String, Object> map(Object... objects) {

    if (objects.length % 2 != 0) {
      throw new ActivitiIllegalArgumentException("The input should always be even since we expect a list of key-value pairs!");
    }

    Map<String, Object> map = new HashMap<String, Object>();
    for (int i = 0; i < objects.length; i += 2) {
      map.put((String) objects[i], objects[i + 1]);
    }

    return map;
  }
587452
@SafeVarargs
	public static <T> ArrayList<T> newArrayList(T... values) {
		return (ArrayList<T>) list(false, values);
	}
688852
public static <K, V> void putListMult(Map<K, List<V>> map, K key,
            Collection<? extends V> values) {
        for (V value : values) {
            putList(map, key, value);
        }
    }
115058
public static <K, V> void putIntoListMap(K key, V value, Map<? super K, List<V>> map) {
		List<V> list = map.get(key);
		if (list == null) {
			list = Lists.newArrayListWithCapacity(2);
			map.put(key, list);
		}
		list.add(value);
	}
1138426
public static <E> Set<E> newHashSet(E... values) {
    Set<E> set = new HashSet<E>(values.length);
    for (E e : values) {
      set.add(e);
    }
    return set;
  }
776712
public static <E> List<E> newArrayList(E... values) {
    List<E> list = new ArrayList<E>(values.length);
    for (E e : values) {
      list.add(e);
    }
    return list;
  }