I was super-excited to learn Go, but it was a showstopper to discover that Go's lack of support for generics effectively made this pattern of programming impossible. Major disappointment.
[a] is a list of a, [b] is a list of b. Map takes a function that takes an a and returns a b, and applies it to every element of [a] in order to produce the [b]. An example usage is
map lessThanThree [1,2,3,4]
In this case, map takes a function where a is an integer, and b is a boolean, then takes a list of integers and produces a list of booleans.The result is [True,True,False,False]
map :: (a -> b) -> ([a] -> [b])
so instead of thinking that map takes a function and a list and applies that function to the list, we can think that map takes a function and "lifts" that functions argument and result types to the list type.
This thinking leads us directly to Functors and fmap
Thinks that will make your life easier
* Collections2.filter() -> this is just filter()
* Collections2.transform() -> this is map()
* ImmutableMap.of() -> for when you need to create a quick lookup
You still have to make an anonymous inner class every time you want to pass a function as an argument though.