Is there a viable generic version of org.apache.commons.collections.CollectionUtils?  If not, why not?  It seems like an obvious need.  Or has the Java community just given up on functional coding until closures are added to Java 17?
            Asked
            
        
        
            Active
            
        
            Viewed 9,545 times
        
    16
            
            
         
    
    
        skaffman
        
- 398,947
- 96
- 818
- 769
 
    
    
        kevin cline
        
- 2,608
- 2
- 25
- 38
- 
                    Closures didn't make it into Java7. – skaffman Aug 10 '11 at 18:26
- 
                    9@skaffman: that's why the OP said Java 17... – Bruno Reis Aug 10 '11 at 18:30
- 
                    Well, we got lambdas but since they can't throw checked exceptions it's pretty lame. I guess the language will be crippled until they finally do something to disable checked exceptions somehow. – kevin cline Jan 24 '18 at 18:39
2 Answers
13
            
            
        Looks like situation around Apache Commons Collections has changed. API version 4.0 is strongly typed. It is already available in Maven Central Repository.
 
    
    
        JeanVEGA
        
- 141
- 1
- 5
13
            There's a genericified port of a slightly out-of-date version of Commons Collections here. It's no longer maintained, however.
A better option is Google Guava.  It has classes like Lists, Sets, Collections2 etc that are the equivalent to Commons' CollectionUtils.  Guava is not a one-for-one port of Commons Collections, but it has a better designed and more consistent API. Takes a bit of adjusting to, if you're used to Commons Collections.
 
    
    
        skaffman
        
- 398,947
- 96
- 818
- 769
- 
                    I'm happy with Guava, largely because it isn't a port of Commons Collections. It's much better designed. – kevin cline Jan 22 '14 at 14:42