The Java Evolution of Eclipse Collections
Speaker: Kristen O’Leary
See the list of all blog posts from the conference
- was once GS (Goldman Sachs) Collections
- Memory efficient collections framework
- Open sourced in 2012
- 8.0 compatible with Java 8+
- Extend Java 8 Functional Interfaces
- New APIs – ex: reduceInPlace
- RichIteratable.detectWith() used to rutn null if no match
- Pre Java-8 could use detectIfNone() to create if doesn’t exist
- New method detectWithOptional() which returns Optional wrapper
- Collectors2 has collectors
- Can collect into Bag, ImmutableSet, BiMap, Stack, etc
- Have full primitive collections library
- Have full set of multi-map (map with multiple values for same key ex: key to list/set)
- Have extra APIs like chunk() and zip()
- RichIterable is common interface so default methods helpful.
- Used to add reduceInPlace() so don’t need to stream and create new collection
- Also useful for asLazy() or toImutabile() since Eclipse Collections doesn’t provide stream() there.
- Code generate the primitive classes so symmetry
- Showed impressive memry savings – Eclipse Collections and Trove equivalent. Much smaller than with autoboxing and faster too
- LazyIterable availalbe for all 8 primitive types. Just call asLazy(). A LazyIterabe can be reused unlike a stream.
- Module system
- Internal API Encapsulation
- Need to change APIs that use reflection in order to build. Can’t call setAccessible(true) any more.
- There is a command line argument to ignore reflection errors. Don’t want to impose that on callers
I like that Kristen uses kata examples to show hw the APIs work.