Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Jupyter 5

You're reading from   Learning Jupyter 5 Explore interactive computing using Python, Java, JavaScript, R, Julia, and JupyterLab

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher
ISBN-13 9781789137408
Length 282 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (18) Chapters Close

Title Page
Packt Upsell
Contributors
Preface
1. Introduction to Jupyter FREE CHAPTER 2. Jupyter Python Scripting 3. Jupyter R Scripting 4. Jupyter Julia Scripting 5. Jupyter Java Coding 6. Jupyter JavaScript Coding 7. Jupyter Scala 8. Jupyter and Big Data 9. Interactive Widgets 10. Sharing and Converting Jupyter Notebooks 11. Multiuser Jupyter Notebooks 12. What's Next? 1. Other Books You May Enjoy Index

Java Collections


Java Collections went through a major rework in the last few releases of Java. You can now use a lambda function to describe your comparison point. If that addressed object has the built-in compareTo function (all of the standard Java objects do), then you are done.

In this case, we build a list of strings (country names) and pass that list to the Collections.sort routine. The sort routine becomes very minor, invoking the built-in compareTo functions for String in Java:

 

When we run, we can see the results in a sorted order.

There is likely a way to do this without modifying the passed-in array.

Java streams

Java streams was a significant improvement with Java 8. Now, Java is able to deal with streams of information flow in a functional manner. In this example, we will use stream in several small examples to show the power of the feature.

The code snippet we are using is as follows:

public class MyStreams { 
 
    public static void main(String[] args) { 
          List<Integer...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images