TimurMahammadov / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

[RFE] Provide static helper methods as Functions? #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Many of the helper methods you provide in Lists, Maps, Sets, and other
places would lend well to composition using Functions.

For example, instead of providing all of those forms of immutableBiMap, you
could instead provide them all as newBiMap and immutableBiMap would just
take a BiMap. If they were all provided as static Functions a consumer
could choose to simply compose a form of newBiMap with immutableBiMap to
get the same effect.

I'm not suggesting the static helper methods be replaced, I believe both
forms should be provided.

Original issue reported on code.google.com by estebis...@gmail.com on 11 Apr 2008 at 4:56

GoogleCodeExporter commented 9 years ago
I'm nor sure exactly what you're suggesting. 

The methods you're referring to exists mainly for convenience; they reduce the
keystrokes necessary for some frequently used logic. However, Functions are 
generally
rather verbose, making them less convenient.

Of course, explicit proposals of helpful new methods are always welcome.

Original comment by jared.l....@gmail.com on 12 Apr 2008 at 3:50

GoogleCodeExporter commented 9 years ago
The suggestion is really just wrapping those methods as Functions for easy
composition with Function.compose. Functions are less convenient when you have 
to
write them inline as local anonymous classes, but as static final members of the
classes containing the original methods they wrap, they could be quite 
convenient.

Original comment by estebis...@gmail.com on 12 Apr 2008 at 2:47

GoogleCodeExporter commented 9 years ago
Could you provide an explicit example? 

Your initial bug report suggested a Function that converts a bimap into an 
immutable
bimap. However, we already have a Maps method that creates an unmodifiable 
bimap:
  public static <K,V> BiMap<K,V> unmodifiableBiMap(BiMap<K,V> bimap)
That method is easier to use than a Function would be.

Original comment by jared.l....@gmail.com on 14 Apr 2008 at 6:14

GoogleCodeExporter commented 9 years ago
I'm closing this because the problem description is vague. If someone suggests a
specific method that would be helpful, we'll consider whether to include it.

Original comment by jared.l....@gmail.com on 2 May 2008 at 5:07