The first thing that comes to our mind when we talk about Java 8 is functional programming. But when we dive deeper inside Java8, we will unearth the concepts of processing Collections in an efficient and better way using Stream API.
This presentation explores the Stream APIs with various real time scenarios in the simplest way possible.
Please like if you find it helpful and leave a comment if you have any questions on Stream APIs or on the sections covered.
Comparing 30 Elastic Search operations with Oracle SQL statementsLucas Jellema
Create index and mappings, update documents, do geospatial searches, advanced aggregations, filter and match, facets with Elastic Search
Comparing ElasticSearch actions with counterpart operations in Oracle Database (SQL, PL/SQL, Text index, Locator)
Download sources from GitHub: https://github.com/lucasjellema/sig-elasticsearch-february-2018
Designing REST API automation tests in KotlinDmitriy Sobko
The document discusses designing REST API automation tests in Kotlin. It covers microservices architecture, REST APIs, backend testing principles, the Kotlin programming language, Cucumber BDD framework, Spring Boot framework, and how to combine these tools for testing. The goals are to create tests that are stable, resistant to code changes, fast, extensible, and easily supported.
Presentation of the new OpenERP API. Raphael Collet, OpenERPOdoo
The document discusses proposed changes to OpenERP's Python API to make it more object-oriented and Pythonic. Key changes include adding method decorators to define behavior, representing records as recordsets that support iteration and slicing, automatic caching and invalidation, and a new field definition syntax. The goal is to keep the API backwards compatible while improving its structure.
Core Software Group and the Denver Plone Users Group hosted the Denver World Plone Day on April 22, 2009 at the Tivoli Center in downtown Denver. The presentation was given by Chris Crownhart and talked about Core Software Group's custom development techniques for some of the Plone sites we have built.
The document discusses several ways to write recursive functions in Swift, including functions to calculate the factorial of a number, find the nth Fibonacci number, and determine if a number contains the digit 7. It also provides examples of using tail recursion to iterate over an array and reduce it to a single value, as well as using tail recursion with custom functions.
Here are the key points about closure arguments in Groovy:
- Closures can take arguments like regular methods
- Arguments are specified inside the closure definition between parentheses ()
- Argument names are specified like method parameters (e.g. num, id)
- If no arguments are needed, the parentheses can be omitted
- The last argument can optionally be a special variable called "it" which represents the argument passed to the closure
- Closures are first-class and can be passed to methods like regular arguments
So in summary:
Closures in Groovy allow defining inline anonymous functions that can take arguments like regular methods. The arguments are specified in the closure definition between parentheses and represent the values passed when calling
This document provides an overview of programming with Go Lang. It discusses why Go Lang is useful, including its support for multicore performance, microservices, concurrency, static binaries, and testing. It then covers various Go Lang content like first apps, types, loops, functions, arrays/slices/maps, interfaces, methods, empty interfaces, pointers, and error handling. Code examples are provided to demonstrate many of these concepts.
Comparing 30 Elastic Search operations with Oracle SQL statementsLucas Jellema
Create index and mappings, update documents, do geospatial searches, advanced aggregations, filter and match, facets with Elastic Search
Comparing ElasticSearch actions with counterpart operations in Oracle Database (SQL, PL/SQL, Text index, Locator)
Download sources from GitHub: https://github.com/lucasjellema/sig-elasticsearch-february-2018
Designing REST API automation tests in KotlinDmitriy Sobko
The document discusses designing REST API automation tests in Kotlin. It covers microservices architecture, REST APIs, backend testing principles, the Kotlin programming language, Cucumber BDD framework, Spring Boot framework, and how to combine these tools for testing. The goals are to create tests that are stable, resistant to code changes, fast, extensible, and easily supported.
Presentation of the new OpenERP API. Raphael Collet, OpenERPOdoo
The document discusses proposed changes to OpenERP's Python API to make it more object-oriented and Pythonic. Key changes include adding method decorators to define behavior, representing records as recordsets that support iteration and slicing, automatic caching and invalidation, and a new field definition syntax. The goal is to keep the API backwards compatible while improving its structure.
Core Software Group and the Denver Plone Users Group hosted the Denver World Plone Day on April 22, 2009 at the Tivoli Center in downtown Denver. The presentation was given by Chris Crownhart and talked about Core Software Group's custom development techniques for some of the Plone sites we have built.
The document discusses several ways to write recursive functions in Swift, including functions to calculate the factorial of a number, find the nth Fibonacci number, and determine if a number contains the digit 7. It also provides examples of using tail recursion to iterate over an array and reduce it to a single value, as well as using tail recursion with custom functions.
Here are the key points about closure arguments in Groovy:
- Closures can take arguments like regular methods
- Arguments are specified inside the closure definition between parentheses ()
- Argument names are specified like method parameters (e.g. num, id)
- If no arguments are needed, the parentheses can be omitted
- The last argument can optionally be a special variable called "it" which represents the argument passed to the closure
- Closures are first-class and can be passed to methods like regular arguments
So in summary:
Closures in Groovy allow defining inline anonymous functions that can take arguments like regular methods. The arguments are specified in the closure definition between parentheses and represent the values passed when calling
This document provides an overview of programming with Go Lang. It discusses why Go Lang is useful, including its support for multicore performance, microservices, concurrency, static binaries, and testing. It then covers various Go Lang content like first apps, types, loops, functions, arrays/slices/maps, interfaces, methods, empty interfaces, pointers, and error handling. Code examples are provided to demonstrate many of these concepts.
Closure, Higher-order function in SwiftSeongGyu Jo
This document discusses closures and higher-order functions in Swift. It provides examples of using closures as parameters, including sorting an array by passing a closure. It also gives examples of common higher-order functions like map, filter and reduce. Map transforms elements by applying a closure, filter filters elements by a closure condition, and reduce combines elements using a closure.
Everything you always wanted to know about forms* *but were afraid to askAndrea Giuliano
La componente dei Form di Symfony2 rende possibile la costruzione di diverse tipologie di form in modo del tutto semplice. La sua architettura flessibile e altamente scalabile permette di poter gestire strutture adatte ad ogni tipo di esigenza. Tuttavia, conoscere come utilizzare appieno tutta la sua potenza non è banale. In questo talk verrà trattato in profondità la componente Form di Symfony2, mostrando i suoi meccanismi di base e come utilizzarli per estenderli ed introdurre la propria logica di business, così da costruire form cuciti a misura delle tue necessità.
Bernhard Schussek gave a presentation on leveraging Symfony2 forms at the Symfony Live conference in March 2011. He discussed the evolution of the Symfony form component, its service-oriented architecture, and how forms are decoupled from business logic. He provided an example of an online sausage shop order form to demonstrate how form data is bound to objects and submitted. The presentation covered the form configuration class, form processing, field types, validation, embedding forms, and form themes.
Mirror, mirror on the wall: Building a new PHP reflection library (DPC 2016)James Titcumb
Have you ever used PHP's built in reflection, only to find you can't do quite what you wanted? What about finding types for parameters or properties? What about reflecting on classes that aren't loaded, so that you can modify them directly?
Better Reflection is an awesome new library that uses magical time-warp techniques* (*actual magic or time-warp not guaranteed) to improve on PHP's built-in reflection by providing additional functionality. In this talk we'll cover what reflection is all about, explore the cool features of Better Reflection already implemented, the difficulties we faced actually writing the thing, and how you can use Better Reflection in your projects to maximise your reflection-fu.
The document discusses functional programming concepts in Swift such as functors, monads, and higher-order functions. It provides examples of how to use functions like map, flatMap, filter and reduce to transform collections. It also discusses topics like cognitive complexity, pure functions, and how functors are containers that can be mapped while monads support flatMapping to flatten nested collections.
The document summarizes techniques for improving app development in Swift. It discusses using the Result enum to model success and failure states from network requests, using the Cartography framework to simplify auto layout code, representing view states with an enum to avoid ambiguity, and defining shared behaviors with protocols to reduce duplicated code. The techniques aim to make code more readable, simplify view controller logic, centralize state management, and prevent duplicated implementation across unrelated types.
날이 갈수록 쏟아지는 모던 프로그래밍 언어들, 안드로이드 앱 개발자에겐 꿈과 같은 이야기였다고요? 이제는 더 이상 꿈이 아닙니다.
이 세션에서는 구글 I/O 2017에서 안드로이드의 공식 지원 언어로 발표된 코틀린에 대해 간략히 알아보고, 실제 애플리케이션에 적용한 사례를 함께 소개합니다.
Google I/O 2017 Extended Seoul
2017.07.02
This document discusses error management in ZIO compared to Future. It begins with an overview of ZIO and Future effects before comparing how each handles errors. Key differences noted are that Future throws errors away on a side channel while ZIO composes errors. The document recommends best practices for error handling in ZIO like extending exceptions in sealed traits and avoiding reflexive logging. It concludes by discussing how ZIO enables next-generation debugging by tracking fibers and continuations during asynchronous execution.
The document discusses using Rust and Emscripten to compile Rust code to JavaScript and WebAssembly. It covers how to export Rust functions, call JavaScript from Rust, and handle types through Embind to integrate Rust and JavaScript. Embind uses C++ templates to register Rust classes and implement bindings, allowing Rust code to interoperate with JavaScript through Emscripten.
This document summarizes Rails on Oracle and the Oracle enhanced ActiveRecord adapter. It discusses the main components, how the adapter maps data types between Ruby/Rails and Oracle, and how it handles legacy schemas, PL/SQL CRUD procedures, and full-text indexes. It also provides information on testing, contributing, reporting issues and related libraries.
This document contains tips and explanations about various Ruby on Rails concepts and methods, including:
1) Object::try, which allows calling methods on an object that may be nil without raising an error.
2) Object::presence, which returns the object itself unless it is nil or an empty object, in which case it returns nil.
3) Object::send, which allows calling methods by name as a string, including private methods.
4) Other methods like freeze, inject, tap, and ways to extend Ruby classes are also explained briefly.
This document provides an overview of Object Relational Mapping (ORM) using GORM in Grails. It discusses how GORM uses Hibernate under the hood and provides examples of basic CRUD operations and associations like one-to-many and many-to-many relationships. It also covers querying with GORM using dynamic finders, where queries, criteria, HQL and advanced features like events and custom mappings.
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
The document discusses using CoffeeScript to write JavaScript code in a more Ruby-like style. It provides examples of CoffeeScript code for functions, objects, classes, and other concepts. CoffeeScript allows JavaScript code to be written in a cleaner syntax that resembles Ruby. This helps address problems with JavaScript code appearing "ugly" and unfamiliar to developers experienced in Ruby. CoffeeScript transpires to regular JavaScript, enabling the Ruby-like code to run in browsers.
Emerging Languages: A Tour of the HorizonAlex Payne
A tour of a number of new programming languages, organized by the job they're best suited for. Presented at Philadelphia Emerging Technology for the Enterprise 2012.
This document discusses Apache Spark, an open-source cluster computing framework. It introduces Spark and its core components, including Resilient Distributed Datasets (RDDs), DataFrames, and Structured Streaming. It also briefly covers Spark's capabilities for batch processing, streaming, SQL support, machine learning, and running on clusters.
This document provides an overview of GORM (Grails' Object Relational Mapping) including how to create domain classes, perform basic CRUD operations, define associations between classes, customize mappings, add constraints, and query data using various methods. It covers topics such as many-to-one, one-to-many, and many-to-many relationships; eager vs lazy fetching; validation on save; and dynamic finders, criteria, HQL, and detached criteria for querying.
This document describes various single-row functions in SQL that can manipulate or modify data. It discusses character, number, date, and conversion functions and provides examples of how to use functions like TO_CHAR, TO_NUMBER, ROUND, TRUNC, and DECODE in SELECT statements. Common uses of functions include performing calculations, formatting output, converting data types, and conditional processing of data. Nesting functions allows multiple operations to be applied sequentially.
Closure, Higher-order function in SwiftSeongGyu Jo
This document discusses closures and higher-order functions in Swift. It provides examples of using closures as parameters, including sorting an array by passing a closure. It also gives examples of common higher-order functions like map, filter and reduce. Map transforms elements by applying a closure, filter filters elements by a closure condition, and reduce combines elements using a closure.
Everything you always wanted to know about forms* *but were afraid to askAndrea Giuliano
La componente dei Form di Symfony2 rende possibile la costruzione di diverse tipologie di form in modo del tutto semplice. La sua architettura flessibile e altamente scalabile permette di poter gestire strutture adatte ad ogni tipo di esigenza. Tuttavia, conoscere come utilizzare appieno tutta la sua potenza non è banale. In questo talk verrà trattato in profondità la componente Form di Symfony2, mostrando i suoi meccanismi di base e come utilizzarli per estenderli ed introdurre la propria logica di business, così da costruire form cuciti a misura delle tue necessità.
Bernhard Schussek gave a presentation on leveraging Symfony2 forms at the Symfony Live conference in March 2011. He discussed the evolution of the Symfony form component, its service-oriented architecture, and how forms are decoupled from business logic. He provided an example of an online sausage shop order form to demonstrate how form data is bound to objects and submitted. The presentation covered the form configuration class, form processing, field types, validation, embedding forms, and form themes.
Mirror, mirror on the wall: Building a new PHP reflection library (DPC 2016)James Titcumb
Have you ever used PHP's built in reflection, only to find you can't do quite what you wanted? What about finding types for parameters or properties? What about reflecting on classes that aren't loaded, so that you can modify them directly?
Better Reflection is an awesome new library that uses magical time-warp techniques* (*actual magic or time-warp not guaranteed) to improve on PHP's built-in reflection by providing additional functionality. In this talk we'll cover what reflection is all about, explore the cool features of Better Reflection already implemented, the difficulties we faced actually writing the thing, and how you can use Better Reflection in your projects to maximise your reflection-fu.
The document discusses functional programming concepts in Swift such as functors, monads, and higher-order functions. It provides examples of how to use functions like map, flatMap, filter and reduce to transform collections. It also discusses topics like cognitive complexity, pure functions, and how functors are containers that can be mapped while monads support flatMapping to flatten nested collections.
The document summarizes techniques for improving app development in Swift. It discusses using the Result enum to model success and failure states from network requests, using the Cartography framework to simplify auto layout code, representing view states with an enum to avoid ambiguity, and defining shared behaviors with protocols to reduce duplicated code. The techniques aim to make code more readable, simplify view controller logic, centralize state management, and prevent duplicated implementation across unrelated types.
날이 갈수록 쏟아지는 모던 프로그래밍 언어들, 안드로이드 앱 개발자에겐 꿈과 같은 이야기였다고요? 이제는 더 이상 꿈이 아닙니다.
이 세션에서는 구글 I/O 2017에서 안드로이드의 공식 지원 언어로 발표된 코틀린에 대해 간략히 알아보고, 실제 애플리케이션에 적용한 사례를 함께 소개합니다.
Google I/O 2017 Extended Seoul
2017.07.02
This document discusses error management in ZIO compared to Future. It begins with an overview of ZIO and Future effects before comparing how each handles errors. Key differences noted are that Future throws errors away on a side channel while ZIO composes errors. The document recommends best practices for error handling in ZIO like extending exceptions in sealed traits and avoiding reflexive logging. It concludes by discussing how ZIO enables next-generation debugging by tracking fibers and continuations during asynchronous execution.
The document discusses using Rust and Emscripten to compile Rust code to JavaScript and WebAssembly. It covers how to export Rust functions, call JavaScript from Rust, and handle types through Embind to integrate Rust and JavaScript. Embind uses C++ templates to register Rust classes and implement bindings, allowing Rust code to interoperate with JavaScript through Emscripten.
This document summarizes Rails on Oracle and the Oracle enhanced ActiveRecord adapter. It discusses the main components, how the adapter maps data types between Ruby/Rails and Oracle, and how it handles legacy schemas, PL/SQL CRUD procedures, and full-text indexes. It also provides information on testing, contributing, reporting issues and related libraries.
This document contains tips and explanations about various Ruby on Rails concepts and methods, including:
1) Object::try, which allows calling methods on an object that may be nil without raising an error.
2) Object::presence, which returns the object itself unless it is nil or an empty object, in which case it returns nil.
3) Object::send, which allows calling methods by name as a string, including private methods.
4) Other methods like freeze, inject, tap, and ways to extend Ruby classes are also explained briefly.
This document provides an overview of Object Relational Mapping (ORM) using GORM in Grails. It discusses how GORM uses Hibernate under the hood and provides examples of basic CRUD operations and associations like one-to-many and many-to-many relationships. It also covers querying with GORM using dynamic finders, where queries, criteria, HQL and advanced features like events and custom mappings.
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
The document discusses using CoffeeScript to write JavaScript code in a more Ruby-like style. It provides examples of CoffeeScript code for functions, objects, classes, and other concepts. CoffeeScript allows JavaScript code to be written in a cleaner syntax that resembles Ruby. This helps address problems with JavaScript code appearing "ugly" and unfamiliar to developers experienced in Ruby. CoffeeScript transpires to regular JavaScript, enabling the Ruby-like code to run in browsers.
Emerging Languages: A Tour of the HorizonAlex Payne
A tour of a number of new programming languages, organized by the job they're best suited for. Presented at Philadelphia Emerging Technology for the Enterprise 2012.
This document discusses Apache Spark, an open-source cluster computing framework. It introduces Spark and its core components, including Resilient Distributed Datasets (RDDs), DataFrames, and Structured Streaming. It also briefly covers Spark's capabilities for batch processing, streaming, SQL support, machine learning, and running on clusters.
This document provides an overview of GORM (Grails' Object Relational Mapping) including how to create domain classes, perform basic CRUD operations, define associations between classes, customize mappings, add constraints, and query data using various methods. It covers topics such as many-to-one, one-to-many, and many-to-many relationships; eager vs lazy fetching; validation on save; and dynamic finders, criteria, HQL, and detached criteria for querying.
This document describes various single-row functions in SQL that can manipulate or modify data. It discusses character, number, date, and conversion functions and provides examples of how to use functions like TO_CHAR, TO_NUMBER, ROUND, TRUNC, and DECODE in SELECT statements. Common uses of functions include performing calculations, formatting output, converting data types, and conditional processing of data. Nesting functions allows multiple operations to be applied sequentially.
This document provides examples of using different types of built-in functions in SQLite including core, aggregate, and date/time functions. It demonstrates functions like sqlite_version(), random(), max(), min(), upper(), length(), count(), avg(), sum(), date(), datetime(), and strftime(). For example, it shows getting the average car price with avg(cost) and counting the number of unique customers with count(DISTINCT Customer).
The document outlines SQL commands for creating and manipulating databases and tables, including creating and deleting databases and tables, inserting, updating, deleting and reading records from tables, and using clauses like WHERE, ORDER BY, GROUP BY and aggregate functions like COUNT, SUM, AVG, MIN, MAX. It also discusses set operations like UNION, INTERSECT, EXCEPT and using nested queries.
SQL::Abstract::FromQuery parses user queries entered through a web form into data structures that can be used by SQL::Abstract and SQL::Abstract::More to generate SQL queries. It uses Regexp::Grammars to define parsing rules for different field types and value formats. The rules can be extended and customized for different databases and languages. The parser generates criteria hashes that can be passed directly to SQL::Abstract's selection methods to build queries in a safe and portable way from user-provided input.
The document discusses various aggregate functions used in SQL such as SUM, COUNT, AVG, MIN, and MAX. It provides examples of how to use these functions to retrieve aggregated data from tables, including the use of GROUP BY and HAVING clauses. Aggregate functions summarize data over multiple rows, returning a single value. COUNT(*) counts all rows while other functions like COUNT ignore NULL values.
This document discusses refactoring Java code to Clojure using macros. It provides examples of refactoring Java code that uses method chaining to equivalent Clojure code using the threading macros (->> and -<>). It also discusses other Clojure features like type hints, the doto macro, and polyglot projects using Leiningen.
The document provides an outline of key concepts for database programming with MySQL. It discusses MySQL data types, the data definition language (DDL) for defining databases and tables, the data manipulation language (DML) for querying and manipulating data using SQL statements like SELECT, INSERT, UPDATE, DELETE. It also covers MySQL clauses like WHERE, ORDER BY, LIMIT, and joins for retrieving data from multiple tables. The document demonstrates how to connect to and query a MySQL database using PHP with examples of prepared statements. It proposes a course project and assignment to apply the concepts by building a basic application.
The document discusses the four main clauses in SQL: GROUP BY, ORDER BY, WHERE, and HAVING. It provides examples of how to use each clause to group, filter, sort and aggregate data from tables. The GROUP BY clause is used to group duplicate or similar column values and works with aggregate functions. The ORDER BY clause sorts the records in ascending or descending order. The WHERE clause filters rows based on a condition and HAVING filters groups.
PHP record- with all programs and outputKavithaK23
This document provides examples of using different PHP features including strings, arrays, functions, classes, objects, and form validation. It includes 12 examples demonstrating various PHP concepts. The first example shows string manipulation functions. The second demonstrates arrays and array functions. The third calculates a factorial using a user-defined function. Subsequent examples generate an employee payslip using classes and objects, build a student mark entry interface, perform hotel room booking with advanced controls, and validate form data on the client and server sides.
The document provides information on various SQL functions. It discusses functions for sorting query results, performing calculations on aggregate data, grouping data, and filtering groups. Date and string functions are also covered, along with numeric and mathematical functions. Common functions include ORDER BY for sorting, SUM, AVG, COUNT for aggregates, GROUP BY for grouping, and HAVING for filtering groups. NOW() and SYSDATE() are described as functions for returning the current date and time.
This document is a tutorial for the ScalikeJDBC library. It introduces ScalikeJDBC as a tidy SQL-based database access library for Scala developers. It covers key topics like the connection pool, implicit sessions, SQL syntax, the query DSL, testing support, and integration with Play. The tutorial aims to help beginners get started with ScalikeJDBC's main features.
DBIx-DataModel is an object-relational mapping framework for Perl5. Schema declarations are inspired from UML modelling. The API provides efficient interaction with the DBI layer, detailed control on statement execution steps, flexible and powerful treatment of database joins. More on http://search.cpan.org/dist/DBIx-DataModel.
Talk presented at YAPC::EU::2011 Riga (updated from a previous version presented at FPW2010).
The document describes several SQL experiments conducted to create and populate tables, apply constraints, modify schemas, and perform queries. Key points:
1) Tables were created for departments and employees, with data inserted. Describe commands showed the schemas.
2) More tables were created, drop and delete commands were used, and select queries with and without where clauses were run.
3) Schemas were altered by adding columns and modifying data types. Update commands modified existing data.
4) Primary keys, foreign keys, unique constraints and other constraints were applied to newly created tables in various experiments.
5) Select queries used aggregate functions, arithmetic operators, sorting, and nested queries. Joins were performed
This document provides an overview of database concepts including Oracle database tools. It discusses database definitions, the Oracle tools like SQL, PL/SQL, forms and reports. It also covers database objects like tables, constraints, and relationships. Examples are provided for SQL commands, functions, and joins. Key topics include data definition and manipulation languages, data types, constraints, and how to create users and grant privileges.
1. The document discusses various SQL commands for creating, manipulating, and querying database tables. It covers commands like CREATE TABLE, INSERT, SELECT, UPDATE, DELETE, ALTER TABLE, COMMENT, and more.
2. Mathematical functions like COUNT, MAX, MIN, ROUND, TRUNC are described along with logical and comparison operators.
3. The document provides examples of using operators, functions, joins and grouping with detailed explanations.
The document discusses various topics related to Ruby on Rails including SQLite3-Ruby, ERb, and Rack. It provides an overview of how SQLite3-Ruby works with Rails as the default database adapter. It also discusses how to use SQLite3-Ruby outside of Rails, including establishing connections, making queries, and preparing statements. The document then summarizes how ERb works as the template language in Rails and how to use it outside Rails. It ends with a brief mention of Rack.
Patterns for slick database applicationsSkills Matter
Slick is Typesafe's open source database access library for Scala. It features a collection-style API, compact syntax, type-safe, compositional queries and explicit execution control. Community feedback helped us to identify common problems developers are facing when writing Slick applications. This talk suggests particular solutions to these problems. We will be looking at reducing boiler-plate, re-using code between queries, efficiently modeling object references and more.
This document discusses mathematical functions in SQL Server that can perform calculations on columns in tables. It explains aggregate functions like SUM, AVG, MIN, MAX, and COUNT that calculate the total, average, minimum, maximum, and count of values. These functions can be used to find calculations on a single column or combined with GROUP BY to calculate aggregates for each group. Additional functions like UPPER and LOWER can manipulate string values. Examples demonstrate finding total booty, average booty, highest/lowest booty, and robbery case count from a robberies table using these functions.
This document discusses mathematical functions in SQL Server that can perform calculations on table columns, such as SUM, AVG, MIN, MAX, and COUNT. It provides examples of using these aggregate functions to find the total booty, average booty, maximum booty, minimum booty, and number of cases in a sample robberies table. The document also notes that these functions cannot be used with a WHERE clause and explains how to instead use HAVING, ANY, or IN. It describes combining aggregate functions with GROUP BY and using multiple aggregates together.
Similar to Processing Collections with Java8 Stream APIs (20)
How Barcodes Can Be Leveraged Within Odoo 17Celine George
In this presentation, we will explore how barcodes can be leveraged within Odoo 17 to streamline our manufacturing processes. We will cover the configuration steps, how to utilize barcodes in different manufacturing scenarios, and the overall benefits of implementing this technology.
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.pptHenry Hollis
The History of NZ 1870-1900.
Making of a Nation.
From the NZ Wars to Liberals,
Richard Seddon, George Grey,
Social Laboratory, New Zealand,
Confiscations, Kotahitanga, Kingitanga, Parliament, Suffrage, Repudiation, Economic Change, Agriculture, Gold Mining, Timber, Flax, Sheep, Dairying,
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...EduSkills OECD
Andreas Schleicher, Director of Education and Skills at the OECD presents at the launch of PISA 2022 Volume III - Creative Minds, Creative Schools on 18 June 2024.
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
This presentation was provided by Racquel Jemison, Ph.D., Christina MacLaughlin, Ph.D., and Paulomi Majumder. Ph.D., all of the American Chemical Society, for the second session of NISO's 2024 Training Series "DEIA in the Scholarly Landscape." Session Two: 'Expanding Pathways to Publishing Careers,' was held June 13, 2024.
The chapter Lifelines of National Economy in Class 10 Geography focuses on the various modes of transportation and communication that play a vital role in the economic development of a country. These lifelines are crucial for the movement of goods, services, and people, thereby connecting different regions and promoting economic activities.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
2. • Introduction
• Processing Collections - Java7 Vs Java8
• Introducing Java8 Stream APIs.
• Basic operations using Streams
• Advanced operations.
• Parallel stream.
• Read Stream of Lines from a File.
In This Tutorial ..
3. • Java Stream is an abstraction that lets you process data in a
declarative way.
• Perform SQL like operations on Collections.
• process really large collections efficiently By leverage Multi core
architectures.
What is Stream ?
4. Processing Collections - Java7 Vs Java8
• Find the list of employee ids sorted based on their Salary in a given
city.
List<Employee> employeeList =
StreamDemoHelper.getEmployeeList();
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
Each row in the above table represents Employee
Object.
5. List<Employee> employeeList = StreamDemoHelper.getEmployeeList(
List<Employee> melboureEmployees = new ArrayList<>();
for(Employee emp : employeeList){
if(emp.getCity().equals("MEL")){
melboureEmployees.add(emp);
}
}
Collections.sort(melboureEmployees, new Comparator<Employee>(){
@Override
public int compare(Employee o1, Employee o2) {
return o2.getSalary().compareTo(o1.getSalary());
}
});
List<Long> melEmpIdList = new ArrayList<>();
for(Employee emp : melboureEmployees){
melEmpIdList.add(emp.getEmployeeId());
}
Processing Collections - Java7
1. Iterate the list of Employees
and check each employees
city and add it to a separate
list.
2. Sort the list of Employees in
Melbourne based on salary.
3. Iterate Melbourne
employees and then add it
to separate list of ids.
Output: [1, 4, 3]
6. List<Long> empIds =
employeeList.stream()
.filter(emp -> emp.getCity().equals("MEL"))
.sorted(comparing(Employee::getSalary)
.reversed())
.map(emp -> emp.getEmployeeId())
.collect(toList());
Processing Collections – Java8
Only Declare what need to
be performed using Steam
APIs.
This code will produce the
same result as that of
previous code.
Don’t worry if you don’t
understand, we will see all the
Stream APIs in the next slides.
8. 1. Filter Employees based on city.
2. Total number of people whose salary greater than $230
3. Find List of Employee ids whose salary is less than $250 of a given
city.
4. Distinct Cities in which employees has salaries less than $250
5. Find total amount of money spent on Salaries Every Month.
6. Other operations..
Basic operations using Streams
9. Filter Employees based on city.
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
EMP ID City Salary
1 MEL 250
3 MEL 150
4 MEL 200
List<Employee> melEmpList = employeeList.stream()
.filter(emp -> emp.getCity().equals("MEL"))
.collect(Collectors.toList());
filter() method takes lamda expression of
Predicate type and filters the stream based on
the condition defined.
collect() method collects the filtered Steam objects
and converts it to List of Employee objects using
Collectors.toList() method defined inside it.
Collectors class has toSet(), toMap(), toConcurrentMap(), toCollection() methods to convert
the stream of objects to a particular type of collection.
10. Total number of people whose salary greater than $230
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
Long count = employeeList.stream()
.filter(emp -> emp.getSalary() > 230)
.count();
Filter employees whose salary is greater than
$250
count() will return the total of the filtered items.
count = 3
11. Find List of Employee ids whose salary is less than $250 of a
given city.
List<Long> melEmpIds = employeeList.stream()
.filter(emp -> emp.getCity().equals("MEL")
&& emp.getSalary() < 250)
.map(emp -> emp.getEmployeeId())
.collect(toList());
filter method actually return stream of employee
objects which is Stream<Employee>.
map() functions comes to our rescue to create a
stream of whatever we want based on the
employee object. map() function returns stream
of whatever that is returned in the lamda
expression that is passed to it. In our case map()
function returns Stream of employee ids.
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
EMP ID City Salary
1 MEL 250
3 MEL 150
4 MEL 200
[3, 4]
filter()
map()
12. some more examples of map() function…
List<Bonus> bonusList = employeeList.stream()
.map(emp -> new Bonus(emp.getEmployeeId(),
emp.getSalary() * 1.5))
.collect(toList());
The Lamda expression of map() function
returns Bonus object based on Employee
object and hence we get Stream of Bonus
objects which is Stream<Bonus>
whoAmI = employeeList.stream()
.map(emp -> {
Integer tax =calculateTaxes(emp);
//Date date = get payroll date.
return new Payroll(emp.getEmpId,
emp.geSalary,
date,
tax);
})
.collect(toList());
Guess what is the type of whoAmI ?
It is List<Payroll>
13. Find total amount of money spent on Salaries Every Month.
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
Long sumOfSalaries = employeeList.stream()
.mapToLong(emp -> emp.getSalary())
.sum();
sum() will return the total of all the salaries.
}Total = 1680
mapToLong() is similar to map() function except
map() returns Stream<Object> whereas
maptoLong returns LongStream object and helps
us perform sum() of all the Longs. Similarly, we have mapToInt() &
mapToDouble() to be used with
Integer and Double.
14. Distinct Cities in which employees has salaries less than $250
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
List<String> distinctCities =
employeeList.stream()
.filter(emp -> emp.getSalary() < 250)
.map(emp -> emp.getCity())
.distinct()
.collect(toList());
First filtering employees whose salary is less
than $300
distinct() method basically removes all the
duplicates.
MEL
MEL
SYD
SYD
filter()
[MEL,
SYD]
distinct()
15. Other Operations..
Check whether all the employees have salary
greater than $75. In this case it will return true.
Boolean allMatch = employeeList.stream()
.allMatch(emp -> emp.getSalary() > 75);
Double averageLong = employeeList.stream()
.collect(averagingLong(Employee::getSalary));
Highest & Lowest salaried employees.
Average salary in the company
Optional<Employee> minSalariedEmployee =
employeeList.stream()
.collect(minBy(comparing(Employee::getSalary)));
For maximum salaried employee use maxBy() function of Collectors class.
Please check Collectors method for other functions like reducing(), joining(), mapping() etc.
16. 1. Group employees based on whether salary greater than $250
2. Group employees based on City and order by Salary
3. Group employees based on city and then group each city by the
role of the employee and order by salary.
Advance operations using Streams
17. 1. Group employees based on whether salary greater than
$250
Map<Boolean , List<Employee> > partitionByMap =
employeeList.stream()
.collect(Collectors.partitioningBy(emp ->
emp.getSalary() > 250));
partitioningBy() method groups the collection
based on the codition passed to it. In this case
employees are grouped based on whether their
salary is greater than $250.
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
true [emp6, emp5]
false [emp1, emp3, emp2, emp7, emp4]
Map<Boolean, List<Employee>>
List<Employee>
18. Group employees based on City whose salary > 150 and order
by Salary
Map<String, List<Employee>> groupByCity =
employeeList.stream()
.filter(emp -> emp.getSalary() > 150)
.sorted(comparing(Employee::getSalary).reversed())
.collect(Collectors.groupingBy(emp -> emp.getCity()));
Collectors.groupingBy() is used to group the
collection based on the return type of the lamda
defined in it. In this case we are grouping based
on the City.
Just Note that in this case , grouping happens on
the filtered and sorted collection which we passed
to the collect method.
EMP ID City Salary
1 MEL 250
3 MEL 150
2 SYD 230
6 BRS 400
5 SYD 350
7 SYD 100
4 MEL 200
BRS [emp6]
MEL [emp1, emp4]
SYD [emp5, emp2]
Map<String, List<Employee>>
List<Employee>
20. Group employees based on city and then group each city by
the role of the employee and order by salary.
Map<String, Map<String, List<Employee>>>
groupByCityAndRole = employeeList.stream()
.sorted(comparing(Employee::getSalary).reversed())
.collect(groupingBy(emp -> emp.getCity(),
groupingBy(emp -> emp.getRole())));
Collectors.groupingBy() overloaded method
first takes initial criteria and second
parameter is Collectors object.
And hence we can use any method which
returns collectors object as second
parameter.. So, we passed another
groupingBy() method to further classify
employees based on the role in each city.
21. EMP ID City Salary Role
1 MEL 250 Developer
3 MEL 150 Developer
2 SYD 230 Developer
6 BRS 400 Director
5 SYD 350 Developer
7 SYD 100 Manager
4 MEL 200 Manager
List<Employee>
BRS MEL
DeveloperDirector Manager
[Emp6] [emp1, emp3] [Emp4]
SYD
Developer Manager
[emp5, emp2] [Emp7]
.. Continued
22. Parallel stream.
Note, that parallelism is not automatically faster than performing operations serially, although it can be if you have
enough data and processor cores.
List<Long> melEmpIds = employeeList.parallelStream()
.filter(emp -> emp.getCity().equals("MEL")
&& emp.getSalary() < 250)
.map(emp -> emp.getEmployeeId())
.collect(toList());
Aggregate operations and parallel streams enable
you to implement parallelism with non-thread-safe
collections provided that you do not modify the
collection while you are operating on it.
23. Read Stream of Lines from a File
Stream<String> streamOfLines = Files.lines(Paths.get(”/tmp/transaction.csv”));
The above code reads the file from path specified and creates stream of
Line. Each line is represented in the String format.