fangfangli / cleartk

Automatically exported from code.google.com/p/cleartk
0 stars 0 forks source link

switch from commons-collections to guava? #225

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
So commons-collections is taking forever to get updated for generics, and the 
net.sourceforge.collections that we're using instead was last updated in 2006. 
What do you think about switching from commons-collections to 
google-collections (now called Guava and under the Apache 2.0 license)? I'd 
like to be able to use some of their nice collections like Multimaps:

    ListMultimap<Int, String> map = ArrayListMultimap.create();
    map.put(1, "a");
    map.put(1, "b");
    map.put(2, "c");
    for (String value: map.get(1) {
        ...
    }

http://code.google.com/p/guava-libraries/

Here are some other arguments for making this switch:

http://stackoverflow.com/questions/4542550/what-are-the-big-improvements-between
-guava-and-apache-equivalent-libraries

If we go this route, we could do the following replacements:

BidiMap => BiMap
DualHashBidiMap => HashBiMap

There are some other cool things in the Guava libraries:

http://blog.publicobject.com/2007/09/series-recap-coding-in-small-with.html
http://blog.solidcraft.eu/2010/10/googole-guava-v07-examples.html

We could replace some uses of collections-io, though my impression was that we 
couldn't replace them all:

IOUtils.copy => ByteStreams.copy (for streams), Files.copy (for files)
FileUtils.readFileToString => Files.toString
FileUtils.writeStringToFile => Files.write
FileUtils.deleteDirectory => Files.deleteRecursively
filefilter.* => Predicates.*
FileUtils.iterateFiles => ?

Original issue reported on code.google.com by steven.b...@gmail.com on 3 Feb 2011 at 3:21

GoogleCodeExporter commented 9 years ago
sounds good.

Original comment by phi...@ogren.info on 3 Feb 2011 at 5:10

GoogleCodeExporter commented 9 years ago
I don't see any substitution for FileUtils.iterateFiles in Guava.  I have need 
for this right now - so I thought I would take a look at Guava and see if there 
was anything there.  It doesn't appear to have it.  I don't think we can live 
without something very flexible like the IOFileFilter stuff.  This is not to 
say we can't use Guava - but it doesn't look like we can get rid of commons-io 
for now.  

Original comment by phi...@ogren.info on 7 Feb 2011 at 6:32

GoogleCodeExporter commented 9 years ago
Yep, that was my conclusion as well after looking for something like 
iterateFiles again recently. So I think (when I get around to it) we should 
just replace commons-collections with guava collections, and leave all the 
commons-io stuff as it is.

Original comment by steven.b...@gmail.com on 7 Feb 2011 at 7:23

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2869.

Original comment by steven.b...@gmail.com on 28 Apr 2011 at 9:57