Collections are a staple in any programming language: the need to collect, sort or iterate over values is needed by nearly all developers. The Java language introduced the Collections framework long ago and that's what many (incredibly not all!) developers learn when they start programming. It has plenty to offer, but many find it lacking: the amount of collection libraries as active open source projects demonstrate the need for something else. If we were to search to find a holistic comparison of famous collection libraries, there is not much literature available. This talk is poised to fill this gap. In this session, we will explore the most common collections (pun intended!) frameworks, what they have to offer and what you should consider for your next project. We will also show common programmer use cases, how each library handles them and the impact on memory, processing power and ease of use/coding. After this session, you will be able to choose the right bag for you tricks!
This session is for both beginner and seasoned developers that would help them choose which collections framework is better for their projects. While they can look very much alike, there are key differences regarding performance, style of programming and memory impact that are not explicit until you already committed to using one framework over the other. The goal is to present common use cases for collections, the frameworks available and how to use them.
Presented at Devoxx US (http://cfp.devoxx.us/2017/talk/PEV-2089)
Collections are a staple in any programming language: the need to collect, sort or iterate over values is needed by nearly all developers.
The Java language introduced the Collections framework long ago and that's what many (incredibly not all!) developers learn when they start programming. It has plenty to offer, but many find it lacking: the amount of collection libraries as active open source projects demonstrate the need for something else.
If we were to search to find a holistic comparison of famous collection libraries, there is not much literature available. The talk is poised to fill this gap. In this session, we will explore the most common collections (pun intended!) frameworks, what they have to offer and what you should consider for your next project.
We will also show common programmer use cases, how each library handles them and the impact on memory, processing power and ease of use/coding.
After this session, you will be able to choose the right bag for you tricks!
Collections are a staple in any programming language: the need to collect, sort or iterate over values is needed by nearly all developers. The Java language introduced the Collections framework long ago and that's what many (incredibly not all!) developers learn when they start programming. It has plenty to offer, but many find it lacking: the amount of collection libraries as active open source projects demonstrate the need for something else. If we were to search to find a holistic comparison of famous collection libraries, there is not much literature available. This talk is poised to fill this gap. In this session, we will explore the most common collections (pun intended!) frameworks, what they have to offer and what you should consider for your next project. We will also show common programmer use cases, how each library handles them and the impact on memory, processing power and ease of use/coding. After this session, you will be able to choose the right bag for you tricks!
This session is for both beginner and seasoned developers that would help them choose which collections framework is better for their projects. While they can look very much alike, there are key differences regarding performance, style of programming and memory impact that are not explicit until you already committed to using one framework over the other. The goal is to present common use cases for collections, the frameworks available and how to use them.
Collections are a staple in any programming language: the need to collect, sort, or iterate over values is needed by nearly all developers. The Java language introduced the Collections framework long ago. It has plenty to offer, but many find it lacking: the number of collection libraries as active open source projects demonstrates the need for something else. This session does a holistic comparison of the most-common collections (pun intended!) frameworks, what they have to offer, and what you should consider for your next project. It also shows common programmer use cases; how each library handles them; and the impact on memory, processing power, and ease of use/coding. Come and let us help you choose the right bag for your tricks!
So S.O.L.I.D Fu - Designing Better CodeNeil Crookes
A chat about some of the most important principles in software development. Discover or get a refresher on these tried and tested techniques for designing better code.
Code: https://github.com/neilcrookes/SoSOLIDFu/
Apache Spark for Library Developers with Erik Erlandson and William BentonDatabricks
As a developer, data engineer, or data scientist, you’ve seen how Apache Spark is expressive enough to let you solve problems elegantly and efficient enough to let you scale out to handle more data. However, if you’re solving the same problems again and again, you probably want to capture and distribute your solutions so that you can focus on new problems and so other people can reuse and remix them: you want to develop a library that extends Spark.
You faced a learning curve when you first started using Spark, and you’ll face a different learning curve as you start to develop reusable abstractions atop Spark. In this talk, two experienced Spark library developers will give you the background and context you’ll need to turn your code into a library that you can share with the world. We’ll cover: Issues to consider when developing parallel algorithms with Spark, Designing generic, robust functions that operate on data frames and datasets, Extending data frames with user-defined functions (UDFs) and user-defined aggregates (UDAFs), Best practices around caching and broadcasting, and why these are especially important for library developers, Integrating with ML pipelines, Exposing key functionality in both Python and Scala, and How to test, build, and publish your library for the community.
We’ll back up our advice with concrete examples from real packages built atop Spark. You’ll leave this talk informed and inspired to take your Spark proficiency to the next level and develop and publish an awesome library of your own.
Lab session given at OSCON Java 2011:
Visage is the successor to the JavaFX Script Language, a domain-specific language for writing UIs. It excels at rapid application design and can be used on any platform that supports Java. In this lab you will have an opportunity to write Visage applications that deploy to and run on Android mobile devices. No prior experience with Android or Visage development is required.
Presented at Devoxx US (http://cfp.devoxx.us/2017/talk/PEV-2089)
Collections are a staple in any programming language: the need to collect, sort or iterate over values is needed by nearly all developers.
The Java language introduced the Collections framework long ago and that's what many (incredibly not all!) developers learn when they start programming. It has plenty to offer, but many find it lacking: the amount of collection libraries as active open source projects demonstrate the need for something else.
If we were to search to find a holistic comparison of famous collection libraries, there is not much literature available. The talk is poised to fill this gap. In this session, we will explore the most common collections (pun intended!) frameworks, what they have to offer and what you should consider for your next project.
We will also show common programmer use cases, how each library handles them and the impact on memory, processing power and ease of use/coding.
After this session, you will be able to choose the right bag for you tricks!
Collections are a staple in any programming language: the need to collect, sort or iterate over values is needed by nearly all developers. The Java language introduced the Collections framework long ago and that's what many (incredibly not all!) developers learn when they start programming. It has plenty to offer, but many find it lacking: the amount of collection libraries as active open source projects demonstrate the need for something else. If we were to search to find a holistic comparison of famous collection libraries, there is not much literature available. This talk is poised to fill this gap. In this session, we will explore the most common collections (pun intended!) frameworks, what they have to offer and what you should consider for your next project. We will also show common programmer use cases, how each library handles them and the impact on memory, processing power and ease of use/coding. After this session, you will be able to choose the right bag for you tricks!
This session is for both beginner and seasoned developers that would help them choose which collections framework is better for their projects. While they can look very much alike, there are key differences regarding performance, style of programming and memory impact that are not explicit until you already committed to using one framework over the other. The goal is to present common use cases for collections, the frameworks available and how to use them.
Collections are a staple in any programming language: the need to collect, sort, or iterate over values is needed by nearly all developers. The Java language introduced the Collections framework long ago. It has plenty to offer, but many find it lacking: the number of collection libraries as active open source projects demonstrates the need for something else. This session does a holistic comparison of the most-common collections (pun intended!) frameworks, what they have to offer, and what you should consider for your next project. It also shows common programmer use cases; how each library handles them; and the impact on memory, processing power, and ease of use/coding. Come and let us help you choose the right bag for your tricks!
So S.O.L.I.D Fu - Designing Better CodeNeil Crookes
A chat about some of the most important principles in software development. Discover or get a refresher on these tried and tested techniques for designing better code.
Code: https://github.com/neilcrookes/SoSOLIDFu/
Apache Spark for Library Developers with Erik Erlandson and William BentonDatabricks
As a developer, data engineer, or data scientist, you’ve seen how Apache Spark is expressive enough to let you solve problems elegantly and efficient enough to let you scale out to handle more data. However, if you’re solving the same problems again and again, you probably want to capture and distribute your solutions so that you can focus on new problems and so other people can reuse and remix them: you want to develop a library that extends Spark.
You faced a learning curve when you first started using Spark, and you’ll face a different learning curve as you start to develop reusable abstractions atop Spark. In this talk, two experienced Spark library developers will give you the background and context you’ll need to turn your code into a library that you can share with the world. We’ll cover: Issues to consider when developing parallel algorithms with Spark, Designing generic, robust functions that operate on data frames and datasets, Extending data frames with user-defined functions (UDFs) and user-defined aggregates (UDAFs), Best practices around caching and broadcasting, and why these are especially important for library developers, Integrating with ML pipelines, Exposing key functionality in both Python and Scala, and How to test, build, and publish your library for the community.
We’ll back up our advice with concrete examples from real packages built atop Spark. You’ll leave this talk informed and inspired to take your Spark proficiency to the next level and develop and publish an awesome library of your own.
Lab session given at OSCON Java 2011:
Visage is the successor to the JavaFX Script Language, a domain-specific language for writing UIs. It excels at rapid application design and can be used on any platform that supports Java. In this lab you will have an opportunity to write Visage applications that deploy to and run on Android mobile devices. No prior experience with Android or Visage development is required.
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...Payara
Ever thought of implementing a modern cloud architecture with Jakarta EE and MicroProfile applications but don’t know which practices to follow? This talk will highlight 10 strategies that will help you implement robust scalable cloud-ready applications!
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences. For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely. This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
WildFly 8 application server
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
JavaCro 2014 Scala and Java EE 7 Development ExperiencesPeter Pilgrim
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences.
For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely.
This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
Java 9 ships in July, are you ready for Java 9 modules? Java 9 modules (aka Project Jigsaw) is the biggest fundamental change to the Java runtime. Code that use Oracle/Sun private APIs will break. This session will cover the basics of Java 9 modules and also the current state of tooling. The ramifications to existing and legacy applications will be covered along with the steps you’ll need to take to harness the power of modules and write more maintainable systems.
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
This talk is for a very important new feature in Java SE 9. Code named Jigsaw, this feature modularizes the Java SE platform.
The coolest thing we do here is to create a custom JRE
Code: https://bitbucket.org/stybz/jigsaw.sty/
PPT: https://www.slideshare.net/mihailstoynov/modules-in-java-finally-openjdk-jigsaw
Video: https://www.youtube.com/watch?v=W5LeNPtPrqw
A presentation on how to use Webpack to bundle and build a web application using TypeScript and CSS. The presentation demonstrates how to use a few of Webpack's loaders and plugins.
Webpack Encore - Asset Management for the rest of usStefan Adolf
Dealing assets from within monolithic project that even come with a legacy is mostly hard. Encore paves the way for your migration to the "modern" world of frontend technology. It provides an opinonated and very condensed interface to the almighty webpack bundler that just does what you expect from it. Including entry points, tree shaking, code splitting and lazy loading. This talk and its supporting git repo show some of the Encore concepts and comes with a fully working dockerized Symfony 4.2 application utilizing a combined Vue.js and jQuery (sic) frontend. https://github.com/elmariachi111/encore-demo/tree/2019-encore-vue-components (use the 2019- branches)
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...Payara
Ever thought of implementing a modern cloud architecture with Jakarta EE and MicroProfile applications but don’t know which practices to follow? This talk will highlight 10 strategies that will help you implement robust scalable cloud-ready applications!
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences. For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely. This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
WildFly 8 application server
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
JavaCro 2014 Scala and Java EE 7 Development ExperiencesPeter Pilgrim
Scala is an alternative JVM language with both object-oriented and functional programming paradigms. Scala development with the Java EE 7 platform is definitely possible and can be a pleasant experience. If you have uncertainty about how Scala can fit around the Java EE 7 platform, then this session aims to illustrate the huge benefit that Scala adoption can bring to the platform. Many other developers are taking advantage and the challenge of the JVM’s capability of being a vessel for multi-language programming. You no longer have to write every single project using Java, even if you like Lambdas experiences.
For the developer and engineering terms that feeling a little braver than usual, Scala is attractive as it is strongly typed and lets you set the gauge on how object oriented or how functional you want to be. You will learn how to reuse the annotations and creating Scala plain object safely and concisely.
This session will highlight and contrast the experience I had developing Scala solutions with Java EE, and there will be plenty of advice about using the functional programming features against the Java object oriented API.
Scala language overview
Java EE 7 architecture and design
Using Gradle as a build tool
How to create beans in Scala with dependency injection
JAX-RS endpoints
Servlet Endpoints
JMS Messaging
Scala adoption advice and hints for sustainable team development
Java 9 ships in July, are you ready for Java 9 modules? Java 9 modules (aka Project Jigsaw) is the biggest fundamental change to the Java runtime. Code that use Oracle/Sun private APIs will break. This session will cover the basics of Java 9 modules and also the current state of tooling. The ramifications to existing and legacy applications will be covered along with the steps you’ll need to take to harness the power of modules and write more maintainable systems.
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
This talk is for a very important new feature in Java SE 9. Code named Jigsaw, this feature modularizes the Java SE platform.
The coolest thing we do here is to create a custom JRE
Code: https://bitbucket.org/stybz/jigsaw.sty/
PPT: https://www.slideshare.net/mihailstoynov/modules-in-java-finally-openjdk-jigsaw
Video: https://www.youtube.com/watch?v=W5LeNPtPrqw
A presentation on how to use Webpack to bundle and build a web application using TypeScript and CSS. The presentation demonstrates how to use a few of Webpack's loaders and plugins.
Webpack Encore - Asset Management for the rest of usStefan Adolf
Dealing assets from within monolithic project that even come with a legacy is mostly hard. Encore paves the way for your migration to the "modern" world of frontend technology. It provides an opinonated and very condensed interface to the almighty webpack bundler that just does what you expect from it. Including entry points, tree shaking, code splitting and lazy loading. This talk and its supporting git repo show some of the Encore concepts and comes with a fully working dockerized Symfony 4.2 application utilizing a combined Vue.js and jQuery (sic) frontend. https://github.com/elmariachi111/encore-demo/tree/2019-encore-vue-components (use the 2019- branches)
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
2. #CollectionsCompare #GIDS17 @NikhilNanivade
Agenda
1. Introduction
2. History of Java util collections framework
3. Gaps in use cases from the timeline
4. Timeline with other collection frameworks
5. Use case, domain diagrams
6. Deep dive in use case
7. Memory characteristics
6. #CollectionsCompare #GIDS17 @NikhilNanivade
java.util Collections
• Java Collection Framework has been around since
1998/JDK 1.2. Very basic but critical collection
support for Java.
• Interfaces: Maps and Collections (List, Set,
Queue, Deque)
• Implementations: Basic and Concurrent versions
of the interfaces, sorted and concurrent as well
• Algorithms: Sorting, Shuffling, Routine Data
Manipulation, Searching, Composition
• Best way to get started is using the simple and
concurrent tutorials
13. #CollectionsCompare #GIDS17 @NikhilNanivade
Problem Statement – Deck of Cards
1. Create Deck of Cards
– Store Cards in an “Immutable” SortedSet
(Cartesian product of Suit x Rank)
– Group the cards by Suit in an “Immutable” SortedSet
“Multimap” (Group By)
2. Get the number of cards
– Count By Suit returning “Multiset” or “Bag”
– Count By Rank returning “Multiset” or “Bag”
3. Deal five hands of five cards each
– Return the cards as an “Immutable” List of five Sets of five
cards
14. #CollectionsCompare #GIDS17 @NikhilNanivade
Performance Benchmarks
• JMH – Java Microbenchmark Harness
• http://openjdk.java.net/projects/code-tools/jmh/
• Measure Reported – Operations per second
• Bigger numbers are better
• 4 Core Intel I7, 50 Warm-up iterations, 30
measurement iterations, two forks
15. #CollectionsCompare #GIDS17 @NikhilNanivade
Problem Statement – Deck of Cards
1. Create Deck of Cards
– Store Cards in an “Immutable” SortedSet
(Cartesian product of Suit x Rank)
– Group the cards by Suit in an “Immutable” SortedSet
“Multimap” (Group By)
2. Get the number of cards
– Count By Suit returning “Multiset” or “Bag”
– Count By Rank returning “Multiset” or “Bag”
3. Deal five hands of five cards each
– Return the cards as an “Immutable” List of five Sets of five
cards
17. #CollectionsCompare #GIDS17 @NikhilNanivade
A Deck of Cards – Only the Types
public class JDK8DeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, SortedSet<Card>> cardsBySuit;
public class ApacheCommonsDeckOfCards {
private SortedSet<Card> cards;
private MultiValuedMap<Suit, Card> cardsBySuit;
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSortedSetMultimap<Suit, Card> cardsBySuit;
public class GoogleGuavaDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSetMultimap<Suit, Card> cardsBySuit;
public class JavaSlangDeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, ? extends SortedSet<Card>> cardsBySuit;
18. #CollectionsCompare #GIDS17 @NikhilNanivade
A Deck of Cards – Only the Types
public class JDK8DeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, SortedSet<Card>> cardsBySuit;
public class ApacheCommonsDeckOfCards {
private SortedSet<Card> cards;
private MultiValuedMap<Suit, Card> cardsBySuit;
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSortedSetMultimap<Suit, Card> cardsBySuit;
public class GoogleGuavaDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSetMultimap<Suit, Card> cardsBySuit;
public class JavaSlangDeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, ? extends SortedSet<Card>> cardsBySuit;
19. #CollectionsCompare #GIDS17 @NikhilNanivade
A Deck of Cards – Only the Types
public class JDK8DeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, SortedSet<Card>> cardsBySuit;
public class ApacheCommonsDeckOfCards {
private SortedSet<Card> cards;
private MultiValuedMap<Suit, Card> cardsBySuit;
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSortedSetMultimap<Suit, Card> cardsBySuit;
public class GoogleGuavaDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSetMultimap<Suit, Card> cardsBySuit;
public class JavaSlangDeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, ? extends SortedSet<Card>> cardsBySuit;
20. #CollectionsCompare #GIDS17 @NikhilNanivade
A Deck of Cards – Only the Types
public class JDK8DeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, SortedSet<Card>> cardsBySuit;
public class ApacheCommonsDeckOfCards {
private SortedSet<Card> cards;
private MultiValuedMap<Suit, Card> cardsBySuit;
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSortedSetMultimap<Suit, Card> cardsBySuit;
public class GoogleGuavaDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSetMultimap<Suit, Card> cardsBySuit;
public class JavaSlangDeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, ? extends SortedSet<Card>> cardsBySuit;
21. #CollectionsCompare #GIDS17 @NikhilNanivade
A Deck of Cards – Only the Types
public class JDK8DeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, SortedSet<Card>> cardsBySuit;
public class ApacheCommonsDeckOfCards {
private SortedSet<Card> cards;
private MultiValuedMap<Suit, Card> cardsBySuit;
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSortedSetMultimap<Suit, Card> cardsBySuit;
public class GoogleGuavaDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSetMultimap<Suit, Card> cardsBySuit;
public class JavaSlangDeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, ? extends SortedSet<Card>> cardsBySuit;
22. #CollectionsCompare #GIDS17 @NikhilNanivade
A Deck of Cards – Only the Types
public class JDK8DeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, SortedSet<Card>> cardsBySuit;
public class ApacheCommonsDeckOfCards {
private SortedSet<Card> cards;
private MultiValuedMap<Suit, Card> cardsBySuit;
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSortedSetMultimap<Suit, Card> cardsBySuit;
public class GoogleGuavaDeckOfCards {
private ImmutableSortedSet<Card> cards;
private ImmutableSetMultimap<Suit, Card> cardsBySuit;
public class JavaSlangDeckOfCards {
private SortedSet<Card> cards;
private Map<Suit, ? extends SortedSet<Card>> cardsBySuit;
23. #CollectionsCompare #GIDS17 @NikhilNanivade
Problem Statement – Deck of Cards
1. Create Deck of Cards
– Store Cards in an “Immutable” SortedSet
(Cartesian product of Suit x Rank)
– Group the cards by Suit in an “Immutable” SortedSet
“Multimap” (Group By)
2. Get the number of cards
– Count By Suit returning “Multiset” or “Bag”
– Count By Rank returning “Multiset” or “Bag”
3. Deal five hands of five cards each
– Return the cards as an “Immutable” List of five Sets of five
cards
26. #CollectionsCompare #GIDS17 @NikhilNanivade
JDK Collections – Cartesian Product
public class JDK8DeckOfCards {
private SortedSet<Card> cards;
public JDK8DeckOfCards() {
this.cards = Card.streamCards()
.collect(Collectors.collectingAndThen(
Collectors.toCollection(TreeSet::new),
Collections::unmodifiableSortedSet));
}
27. #CollectionsCompare #GIDS17 @NikhilNanivade
Apache Collections – Cartesian Product
public class ApacheCommonsDeckOfCards {
private SortedSet<Card> cards;
public ApacheCommonsDeckOfCards() {
this.cards = Card.streamCards()
.collect(Collectors.collectingAndThen(
Collectors.toCollection(TreeSet::new),
Collections::unmodifiableSortedSet));
}
28. #CollectionsCompare #GIDS17 @NikhilNanivade
Eclipse Collections – Cartesian Product
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSet<Card> cards;
public EclipseCollectionsDeckOfCards() {
this.cards = SortedSets.immutable.with(
Card.streamCards()
.toArray(Card[]::new));
}
29. #CollectionsCompare #GIDS17 @NikhilNanivade
Google Guava – Cartesian Product
public class GoogleGuavaDeckOfCards {
private ImmutableSortedSet<Card> cards;
public GoogleGuavaDeckOfCards() {
this.cards = Card.streamCards()
.collect(ImmutableSortedSet
.toImmutableSortedSet(
Comparator.naturalOrder()));
}
30. #CollectionsCompare #GIDS17 @NikhilNanivade
Javaslang – Cartesian Product
public class JavaSlangDeckOfCards {
private SortedSet<Card> cards;
public JavaSlangDeckOfCards() {
this.cards = Card.streamCards()
.collect(TreeSet.collector());
}
31. #CollectionsCompare #GIDS17 @NikhilNanivade
Problem Statement – Deck of Cards
1. Create Deck of Cards
– Store Cards in an “Immutable” SortedSet
(Cartesian product of Suit x Rank)
– Group the cards by Suit in an “Immutable” SortedSet
“Multimap” (Group By)
2. Get the number of cards
– Count By Suit returning “Multiset” or “Bag”
– Count By Rank returning “Multiset” or “Bag”
3. Deal five hands of five cards each
– Return the cards as an “Immutable” List of five Sets of five
cards
33. #CollectionsCompare #GIDS17 @NikhilNanivade
JDK Collections – Group By
public class JDK8DeckOfCards {
private Map<Suit, SortedSet<Card>> cardsBySuit;
public JDK8DeckOfCards() {
this.cardsBySuit =
Collections.unmodifiableMap(
this.cards.stream()
.collect(Collectors.groupingBy(
Card::getSuit,
Collectors.mapping(
Function.identity(),
Collectors.collectingAndThen(
Collectors.toCollection(TreeSet::new),
Collections::unmodifiableSortedSet)))));
}
34. #CollectionsCompare #GIDS17 @NikhilNanivade
Apache Collections – Group By
public class ApacheCommonsDeckOfCards {
private MultiValuedMap<Suit, Card> cardsBySuit;
public ApacheCommonsDeckOfCards() {
SetValuedMap<Suit, Card> cbs =
MultiMapUtils.newSetValuedHashMap();
this.cards.forEach(card ->
cbs.put(card.getSuit(), card));
this.cardsBySuit =
MultiMapUtils.unmodifiableMultiValuedMap(cbs);
}
35. #CollectionsCompare #GIDS17 @NikhilNanivade
Eclipse Collections – Group By
public class EclipseCollectionsDeckOfCards {
private ImmutableSortedSetMultimap<Suit, Card> cardsBySuit;
public EclipseCollectionsDeckOfCards() {
this.cardsBySuit = this.cards.groupBy(Card::getSuit);
}
36. #CollectionsCompare #GIDS17 @NikhilNanivade
Google Guava – Group By
public class GoogleGuavaDeckOfCards {
private ImmutableSetMultimap<Suit, Card> cardsBySuit;
public GoogleGuavaDeckOfCards() {
ImmutableSetMultimap.Builder<Suit, Card> builder =
new ImmutableSetMultimap.Builder<Suit, Card>()
.orderValuesBy(Comparator.naturalOrder());
this.cards.forEach(card ->
builder.put(card.getSuit(), card));
this.cardsBySuit = builder.build();
}
37. #CollectionsCompare #GIDS17 @NikhilNanivade
Javaslang – Group By
public class JavaSlangDeckOfCards {
private Map<Suit, ? extends SortedSet<Card>> cardsBySuit;
public JavaSlangDeckOfCards() {
this.cardsBySuit = this.cards.groupBy(Card::getSuit);
}
39. #CollectionsCompare #GIDS17 @NikhilNanivade
Problem Statement – Deck of Cards
1. Create Deck of Cards
– Store Cards in an “Immutable” SortedSet
(Cartesian product of Suit x Rank)
– Group the cards by Suit in an “Immutable” SortedSet
“Multimap” (Group By)
2. Get the number of cards
– Count By Suit returning “Multiset” or “Bag”
– Count By Rank returning “Multiset” or “Bag”
3. Deal five hands of five cards each
– Return the cards as an “Immutable” List of five Sets of five
cards
43. #CollectionsCompare #GIDS17 @NikhilNanivade
Apache Collections – Count By
public Bag<Suit> countsBySuit() {
return this.cards.stream()
.map(Card::getSuit)
.collect(Collectors.toCollection(HashBag::new));
}
public MultiSet<Rank> countsByRank() {
return this.cards.stream()
.map(Card::getRank)
.collect(Collectors.toCollection(
HashMultiSet::new));
}
44. #CollectionsCompare #GIDS17 @NikhilNanivade
Eclipse Collections – Count By
public Bag<Suit> countsBySuit() {
return this.cards.asLazy()
.collect(Card::getSuit)
.toBag();
}
public Bag<Rank> countsByRank() {
return this.cards.asLazy()
.collect(Card::getRank)
.toBag();
}
45. #CollectionsCompare #GIDS17 @NikhilNanivade
Google Guava – Count By
public Multiset<Suit> countsBySuit() {
return this.cards.stream()
.map(Card::getSuit)
.collect(Collectors.toCollection(
HashMultiset::create));
}
public Multiset<Rank> countsByRank() {
return this.cards.stream()
.map(Card::getRank)
.collect(Collectors.toCollection(
HashMultiset::create));
}
46. #CollectionsCompare #GIDS17 @NikhilNanivade
Javaslang – Count By
public java.util.Map<Suit, Long> countsBySuit() {
return this.cards.collect(
Collectors.groupingBy(
Card::getSuit,
Collectors.counting()));
}
public java.util.Map<Rank, Long> countsByRank() {
return this.cards.collect(
Collectors.groupingBy(
Card::getRank,
Collectors.counting()));
}
47. #CollectionsCompare #GIDS17 @NikhilNanivade
Problem Statement – Deck of Cards
1. Create Deck of Cards
– Store Cards in an “Immutable” SortedSet
(Cartesian product of Suit x Rank)
– Group the cards by Suit in an “Immutable” SortedSet
“Multimap” (Group By)
2. Get the number of cards
– Count By Suit returning “Multiset” or “Bag”
– Count By Rank returning “Multiset” or “Bag”
3. Deal five hands of five cards each
– Return the cards as an “Immutable” List of five Sets of
five cards
55. #CollectionsCompare #GIDS17 @NikhilNanivade
Memory Benchmarks
• ObjectExplorer, by Dimitris Andrew
• Open Source under Apache License 2.0
• Measure Reported –
– Memory (Kb) vs Size
– Memory (Kb) vs List, Set, Map with 1,000,000 elements
• Smaller the better
Sources
– GitHub:
https://github.com/DimitrisAndreou/memory-measurer
– Found from StackOverflow:
http://stackoverflow.com/a/9368930/5182052