Google Guava Margus Martsepp History Java collections was
- Slides: 13
Google Guava Margus Martsepp
History Java collections was created in 1997 3 big ideas: interfaces (define collections) implementations (concrete or abstract) algorithms (to manipulate collections) • • • Basic idea around this framework: Extensible - people can build on it
Overview 1. Utilities - {static constructors, functional {predicates, transform}} 2. Objects {equal, coalesce, Comparison. Chain} 3. Immutable - {why, how, collections}
Utilities - static constructors Create a list of 2 elements
Utilities - functional - predicates Apply predicates on collections/iterables Functional language equivalent
Utilities - functional - transform Create a transformed view of a collection
Object - {equals, coalesce} Equals (null safe) Coalesce Objects. first. Non. Null(obj, default)
Object - Comparison. Chain Compare. To method:
Immutable - why Why? + Your life is easy (no trust problems) + Free thread safety + Can be used as a constant + Uses less memory - Rejects null values Compared to Collections. unmodifiable? - overhead - unsafe • •
Immutable - how Create a set of elements Immutable. Set. of("a", "b", "c", "a", "d", "b") Using a builder public static final Immutable. Set<Color> GOOGLE_COLORS = Immutable. Set. <Color>builder(). add. All(WEBSAFE_COLORS). add(new Color(0, 191, 255)). build(); Creating a defencive copy Immutable. List. copy. Of(collection);
Immutable - collections JDK Immutable. Collection Immutable. List Immutable. Set Immutable. Sorted. Set Immutable. Map Immutable. Sorted. Map Guava Immutable. Multiset Immutable. Sorted. Multiset Immutable. Multimap Immutable. List. Multimap Immutable. Set. Multimap Immutable. Bi. Map Immutable. Class. To. Instance. Map Immutable. Table
Summary I talked about: 1. Utilities - {static constructors, functional {predicates, transform}} 2. Objects {equal, coalesce, Comparison. Chain} 3. Immutable - {why, how, collections}
The end
- Google collections java
- Sandbox tree seeds
- Lexical ambiguity
- Beneficios de la guaba
- Zecuf syrup side effects
- Homonyms nedir
- Createyourgoogleaccount
- Minimax algorithm java
- Java collections overview
- Java collections framework diagram
- Java collection hierarchy
- Import java.util.* public class test
- Margus kruus
- Tõnu tuppits