Transforms an iterator of key-value pairs into a map

@param keyValues an iterator of key-value pairs
@param <K>       the type of the keys
@param <V>       the type of the values
@return the resulting map
430496
static <K, V> Map<K, V> keyValuesToMap(Iterator<KeyValue<K, V>> keyValues) {
        Map<K, V> map = new HashMap<>();
        keyValues.forEachRemaining(pair -> map.put(pair.getKey(), pair.getValue()));
        return map;
    }
954603
public static <T> List<T> getList(final ContentValues[] values, final Class<T> klass) {
        final List<T> objects = new ArrayList<T>();
        for (int i = 0; i < values.length; i++) {
            final T object = getObject(values[i], klass);
            if (object != null) {
                objects.add(object);
            }
        }
        return objects;
    }
1259228
protected Map<CharSequence, List<V>> wrapValues(Map<CharSequence, List<V>> values) {
        return Collections.unmodifiableMap(values);
    }
227331
public static SparseTensor fromUnorderedKeyValues(int[] dimensionNumbers, int[] dimensionSizes,
      long[] keyNums, double[] values) {
    long[] keyNumsCopy = ArrayUtils.copyOf(keyNums, keyNums.length);
    double[] valuesCopy = ArrayUtils.copyOf(values, values.length);
    return fromUnorderedKeyValuesNoCopy(dimensionNumbers, dimensionSizes, keyNumsCopy, valuesCopy);
  }
1359500
public static Map<String, List<Object>> convertAttributeValuesToMultiValuedObjects(final Map<String, Object> attributes) {
        val entries = attributes.entrySet();
        return entries
            .stream()
            .collect(Collectors.toMap(Map.Entry::getKey, entry -> {
                val value = entry.getValue();
                return CollectionUtils.toCollection(value, ArrayList.class);
            }));
    }
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());
			}
		});
	}
909023
private List<Data> getKeyValueSequence(Map<?, ?> entries) {
        if (entries == null || entries.isEmpty()) {
            return Collections.emptyList();
        }
        List<Data> keyValueSequence = new ArrayList<>(entries.size() * 2);
        for (Map.Entry<?, ?> entry : entries.entrySet()) {
            Object key = entry.getKey();
            Object value = entry.getValue();
            Data dataKey = mapServiceContext.toData(key);
            Data dataValue = mapServiceContext.toData(value);
            keyValueSequence.add(dataKey);
            keyValueSequence.add(dataValue);
        }
        return keyValueSequence;
    }
1369722
static List<String> keyValueString(@Nullable Map<?, ?> keyValueMapping) {
    List<String> result = Lists.newArrayList();
    if (keyValueMapping != null && keyValueMapping.size() > 0) {
      for (Map.Entry<?, ?> entry : keyValueMapping.entrySet()) {
        result.add(entry.getKey() + "=" + entry.getValue());
      }
      Joiner joiner = Joiner.on(",");
      return Collections.singletonList(joiner.join(result));
    }

    return Collections.emptyList();
  }
1211734
public static <K, V1, V2> Iterable<Map.Entry<K, V2>> transformValues(
      Iterable<Map.Entry<K, V1>> input,
      final Function<? super V1, V2> valueTransformer) {
    return Iterables.transform(input, new Function<Entry<K, V1>, Entry<K, V2>>() {
      @Override
      public Entry<K, V2> apply(final Entry<K, V1> input) {
        return Maps.immutableEntry(input.getKey(), valueTransformer.apply(input.getValue()));
      }
    });
  }
11508
@Override
  public Map<K, V> peekAll(final Iterable<? extends K> keys) {
    Map<K, CacheEntry<K, V>> map = new HashMap<K, CacheEntry<K, V>>();
    for (K k : keys) {
      CacheEntry<K, V> e = execute(k, SPEC.peekEntry(k));
      if (e != null) {
        map.put(k, e);
      }
    }
    return heapCache.convertCacheEntry2ValueMap(map);
  }
1129275
public Values<V> values () {
		if (values1 == null) {
			values1 = new OrderedMapValues(this);
			values2 = new OrderedMapValues(this);
		}
		if (!values1.valid) {
			values1.reset();
			values1.valid = true;
			values2.valid = false;
			return values1;
		}
		values2.reset();
		values2.valid = true;
		values1.valid = false;
		return values2;
	}
445638
public static Map mapValues(Mapper mapper, Map map) {
        return mapValues(mapper, map, false);
    }
210242
public static Map<String, Long> toMap(List<KeyLongValue> values) {
    return values
      .stream()
      .collect(uniqueIndex(KeyLongValue::getKey, KeyLongValue::getValue, values.size()));
  }
170751
public Collection<V> values() {
       Set<Map.Entry<K, V>> s = entrySet();
       ArrayList l = new ArrayList(s.size());
       for (Map.Entry e : s) 
           l.add(e.getValue());
       return l;
    }


    /**
     * Return a filtered set of keys.
     * @see Map.keySet
     */
    public Set<K> keySet() {
       Set<Map.Entry<K, V>> s = entrySet();
       HashSet keys = new HashSet(s.size());
       for (Map.Entry e : mBackingMap.entrySet())
           keys.add(e.getKey());
       return keys;
    }


    /**
     * Delegates to backing map.
     * @see java.util.Map.clear()
     */
    public void clear() { 
        mBackingMap.clear(); 
    }


    /**
     * Delegates to backing map.
     * @see java.util.Map.containsKey
     */
    public boolean containsKey(Object key) { 
        return mBackingMap.containsKey(key); 
    }


    /**
     * Delegates to backing map.
     * @see java.util.Map.containsValue
     */
    public boolean containsValue(Object value) {
       return mBackingMap.containsValue(value);
    }

    
    /**
     * Delegates to backing map.
     * @see Object.equals.
     */
    public boolean equals(Object o) {
       return mBackingMap.equals(o);
    }


    /**
     * Delegates to backing map.
     * @see Object.hashCode
     */
    public int hashCode() {
       return mBackingMap.hashCode();
    }


    /**
     * Delegates to backing map.
     * @see java.util.Map.get
     */
    public V get(Object key) {
       return mBackingMap.get(key);
    }

    
    /**
     * Delegates to backing map.
     * @see java.util.Map.isEmpty
     */
    public boolean isEmpty() {
       return mBackingMap.isEmpty();
    }


    /**
     * Delegates to backing map.
     * @see java.util.Map.put
     */
    public V put(K key, V value) {
        return mBackingMap.put(key, value);
    }


    /**
     * Delegates to backing map.
     * @see java.util.Map.putAll
     */
    public void putAll(Map<? extends K,? extends V> m) {
        mBackingMap.putAll(m);
    }
    

    /**
     * Delegates to backing map.
     * @see java.util.Map.remove
     */
    public V remove(Object key) {
        return mBackingMap.remove(key);
    }


    /**
     * Delegates to backing map.
     * @see java.util.Map.size
     */
    public int size() {
        return mBackingMap.size();
    }


    /**
     * Filter interface.
     */
    public interface Filter {
        /**
         * Returns true if the given entry should be included.
         */
        public boolean accept(Map.Entry e);
    }


}
214133
public Map<String, String> toKeyValueMap() {
        Map<String, String> valueMap = new HashMap<String, String>();
        String[] tokens;
        
        if (selectorString.contains(" AND")) {
            String[] chunks = selectorString.split(" AND");
            for (String chunk : chunks) {
                tokens = escapeEqualsFromXpathNodeTest(chunk).split("=");
                valueMap.put(unescapeEqualsFromXpathNodeTest(tokens[0].trim()), tokens[1].trim().substring(1, tokens[1].trim().length() -1));
            }
        } else {
            tokens = escapeEqualsFromXpathNodeTest(selectorString).split("=");
            valueMap.put(unescapeEqualsFromXpathNodeTest(tokens[0].trim()), tokens[1].trim().substring(1, tokens[1].trim().length() -1));
        }
        
        return valueMap;
    }
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;
	}
913595
public Keys<K> keys () {
		if (keys1 == null) {
			keys1 = new OrderedMapKeys(this);
			keys2 = new OrderedMapKeys(this);
		}
		if (!keys1.valid) {
			keys1.reset();
			keys1.valid = true;
			keys2.valid = false;
			return keys1;
		}
		keys2.reset();
		keys2.valid = true;
		keys1.valid = false;
		return keys2;
	}