com.atlassian.bamboo.util
Class BambooMaps

java.lang.Object
  extended by com.atlassian.bamboo.util.BambooMaps

public class BambooMaps
extends java.lang.Object


Method Summary
static
<K,V> java.util.LinkedHashMap<K,V>
mutableLinkedUniqueIndex(java.lang.Iterable<? extends V> values, com.google.common.base.Function<? super V,? extends K> indexGenerator)
           
static
<K,V> java.util.Map<K,V>
mutableUniqueIndex(java.lang.Iterable<? extends V> values, com.google.common.base.Function<? super V,? extends K> indexGenerator)
           
static
<K,V> java.util.Map<K,V>
newHashMapFrom(java.lang.Iterable<? extends V> source, com.google.common.base.Function<V,Pair<K,V>> function)
           
static
<K,V> NullAwareCache<K,V>
newNullAwareCache(com.google.common.cache.CacheBuilder<java.lang.Object,java.lang.Object> builder, com.google.common.cache.CacheLoader<? super K,? extends V> loader)
           
static
<K,V> V
populateMap(java.util.Map<K,V> map, V input, com.google.common.base.Function<? super V,? extends K> indexGenerator)
          Add entry to the map using Function to generate a key
static
<K,V> void
putAll(java.util.Map<K,? super V> map, java.lang.Iterable<Pair<K,V>> iterable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newHashMapFrom

public static <K,V> java.util.Map<K,V> newHashMapFrom(java.lang.Iterable<? extends V> source,
                                                      com.google.common.base.Function<V,Pair<K,V>> function)

putAll

public static <K,V> void putAll(java.util.Map<K,? super V> map,
                                java.lang.Iterable<Pair<K,V>> iterable)

mutableUniqueIndex

public static <K,V> java.util.Map<K,V> mutableUniqueIndex(java.lang.Iterable<? extends V> values,
                                                          com.google.common.base.Function<? super V,? extends K> indexGenerator)

mutableLinkedUniqueIndex

public static <K,V> java.util.LinkedHashMap<K,V> mutableLinkedUniqueIndex(java.lang.Iterable<? extends V> values,
                                                                          com.google.common.base.Function<? super V,? extends K> indexGenerator)

populateMap

public static <K,V> V populateMap(@NotNull
                                  java.util.Map<K,V> map,
                                  @NotNull
                                  V input,
                                  @NotNull
                                  com.google.common.base.Function<? super V,? extends K> indexGenerator)
Add entry to the map using Function to generate a key

Parameters:
map - map that will get an extra element
input - element to be added to map
indexGenerator - function that will generate key for a given element
Returns:
same behavior as Map.put(Object, Object)

newNullAwareCache

@NotNull
public static <K,V> NullAwareCache<K,V> newNullAwareCache(com.google.common.cache.CacheBuilder<java.lang.Object,java.lang.Object> builder,
                                                                  com.google.common.cache.CacheLoader<? super K,? extends V> loader)


Copyright © 2012 Atlassian. All Rights Reserved.