Flip the keys and values of the multimap.
328993
public static <K, V> UnifiedSetMultimap<V, K> flip(SetMultimap<K, V> setMultimap)
    {
        final UnifiedSetMultimap<V, K> result = new UnifiedSetMultimap<V, K>();
        setMultimap.forEachKeyMultiValues(new Procedure2<K, Iterable<V>>()
        {
            public void value(final K key, Iterable<V> values)
            {
                Iterate.forEach(values, new Procedure<V>()
                {
                    public void value(V value)
                    {
                        result.put(value, key);
                    }
                });
            }
        });
        return result;
    }
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();
  }
824837
public SetMultimap<A, B> getKeyValueMultimap() {
    SetMultimap<A, B> map = HashMultimap.create();
    for (A key : keySet()) {
      for (B value : getValues(key)) {
        map.put(key, value);
      }
    }
    return map;
  }
936579
private <T> void storeInMap(MultiValueMap<T> map, T key, String[] values) {
        try {
            map.set(key, values);
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        }
    }
376789
def merge_keyvals_into_map(keyvals, amap):

    """"""

    for kv in keyvals:
        k,v = kv.split('=')
        if k in amap:
            logger.warn('overwriting {0} with {1}'.format(k, v))
        amap[k] = v
9370
def flip_coords(X,loop):
    
    if(loop[0]==1):
        return np.array(map(lambda i: np.array([i[2],i[1],i[0],i[5],i[4],i[3]]),X))
    else:
        return X
786866
private static <K, V> List<KeyValue<K, List<V>>> multimapToList(
      Marshaller<K> keyMarshaller, ListMultimap<Bytes, V> in) {
    List<Bytes> keys = Ordering.natural().sortedCopy(in.keySet());
    ImmutableList.Builder<KeyValue<K, List<V>>> out = ImmutableList.builder();
    for (Bytes keyBytes : keys) {
      K key = keyMarshaller.fromBytes(ByteBuffer.wrap(keyBytes.bytes));
      out.add(KeyValue.of(key, in.get(keyBytes)));
    }
    return out.build();
  }
221023
public static MultiValueMap asMultiValueMap(final String key1, final Object value1, final String key2, final Object value2) {
        val wrap = (Map) wrap(key1, wrapList(value1), key2, wrapList(value2));
        return org.springframework.util.CollectionUtils.toMultiValueMap(wrap);
    }
142777
def keypoint_flip(bbox, d, rows, cols):
    
    if d == 0:
        bbox = keypoint_vflip(bbox, rows, cols)
    elif d == 1:
        bbox = keypoint_hflip(bbox, rows, cols)
    elif d == -1:
        bbox = keypoint_hflip(bbox, rows, cols)
        bbox = keypoint_vflip(bbox, rows, cols)
    else:
        raise ValueError('Invalid d value {}. Valid values are -1, 0 and 1'.format(d))
    return bbox
1094615
function flip($key) {
		$ref=&$this->ref($key);
		return $ref=array_combine(array_values($ref),array_keys($ref));
	}
56831
public static <K, V> MultiValueMap<K, V> toMultiValueMap(Map<K, List<V>> map) {
		return new MultiValueMapAdapter<K, V>(map);

	}
164594
public static <K, V> HashBagMultimap<V, K> flip(BagMultimap<K, V> bagMultimap)
    {
        final HashBagMultimap<V, K> result = new HashBagMultimap<V, K>();
        bagMultimap.forEachKeyMultiValues(new Procedure2<K, Iterable<V>>()
        {
            public void value(final K key, Iterable<V> values)
            {
                Iterate.forEach(values, new Procedure<V>()
                {
                    public void value(V value)
                    {
                        result.put(value, key);
                    }
                });
            }
        });
        return result;
    }
823728
def flip_iterable_dict(d: dict) -> dict:
    """"""

    value_keys = disjoint_union((cartesian_product((v, k))
                                 for k, v in d.items()))
    return dict(value_keys)
1344969
public void putAll(Map m)
    {
        Iterator i = m.entrySet().iterator();
        boolean multi=m instanceof MultiMap;
        while(i.hasNext())
        {
            Map.Entry entry =
                (Map.Entry)i.next();
            if (multi)
                super.put(entry.getKey(),LazyList.clone(entry.getValue()));
            else
                put(entry.getKey(),entry.getValue());
        }
    }
712296
public static <K, V> ListMultimap<K, V> newLinkedHashListMultimap(Multimap<K, V> multimap) {
		int keySetSize = multimap.keySet().size();
		int expectedKeys = Math.max(keySetSize, 2);
		ListMultimap<K, V> result = newLinkedHashListMultimap(expectedKeys,	Math.max(3, multimap.size() / expectedKeys));
		result.putAll(multimap);
		return result;
	}
704096
def map(self, coords):
        
        for tr in reversed(self.transforms):
            coords = tr.map(coords)
        return coords
499800
def _mappingGetValueSet(mapping, keys):
    
    setUnion = set()
    for k in keys:
        setUnion = setUnion.union(mapping[k])
    return setUnion