Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Java 8 on Android

Java 8 on Android

Video: https://skillsmatter.com/skillscasts/8696-java-8-on-android

Java 8 features have finally made their way to the Android world and if you haven't been trying them, you are missing out. This talk is all about getting you up to speed on all of these new features and how to use them. It will be a great primer if you've never looked into them or a refresher if it's been a while.

Alex Florescu

October 26, 2016
Tweet

More Decks by Alex Florescu

Other Decks in Programming

Transcript

  1. Java 8 on Android
    Alex Florescu
    YPlan
    @flor3scu

    View Slide

  2. Outline
    • Backward compatible features
    • Lambdas, method references etc.
    • Android N+ only features
    • Streams, default methods etc.
    • Setup: how to get this working
    • Other useful tidbits and analysis

    View Slide

  3. Notes
    • Slides are online
    • All code is online

    View Slide

  4. Backward-compatible
    features
    • Lambdas
    • Method references
    • Type annotations

    View Slide

  5. API support
    • Official website

    “Also available on API level 23 and lower”
    • Google I/O 2016

    “Backward compatible with Gingerbread”

    View Slide

  6. Backward-compatible
    features
    • Lambdas
    • Method references
    • Type annotations

    View Slide

  7. Lambdas
    & Method references

    View Slide

  8. Functional interface
    • Has exactly one abstract method
    • Can annotate with @FunctionalInterface
    • Not necessary for using lambdas with it

    View Slide

  9. OnClickListener
    public interface OnClickListener {

    void onClick(View v);

    }

    View Slide

  10. Functional interface
    • A lot of standard ones added in java.util.function
    • Consumer — an operation that accepts a single
    input argument and returns no result
    • Function — a function that accepts one
    argument and produces a result
    • Predicate — a predicate (boolean-valued function)
    of one argument
    • Supplier — a supplier of results

    View Slide

  11. Lambdas
    & Method references

    View Slide

  12. Lambdas
    Language construct that simplifies (or flattens)
    anonymous inner classes

    View Slide

  13. Setting listener
    button1.setOnClickListener(new View.OnClickListener() {

    @Override public void onClick(View v) {

    Snackbar.make(mainPanel, "Click listener

    triggered", Snackbar.LENGTH_SHORT).show();

    }

    });

    View Slide

  14. Setting listener
    button1.setOnClickListener(new View.OnClickListener() {

    @Override public void onClick(View v) {

    Snackbar.make(mainPanel, "Click listener

    triggered", Snackbar.LENGTH_SHORT).show();

    }

    });

    View Slide

  15. Setting listener
    button1.setOnClickListener(v -> 

    Snackbar.make(mainPanel, "Click listener triggered", 

    Snackbar.LENGTH_SHORT).show());

    View Slide

  16. Setting listener
    button1.setOnClickListener(v -> 

    Snackbar.make(mainPanel, "Click listener triggered", 

    Snackbar.LENGTH_SHORT).show());

    View Slide

  17. Lambda examples
    // Lambda with no parameters

    Runnable r2 = () -> Timber.d("Lambda test");

    View Slide

  18. Example with params
    participantRedList.setAdapter(

    new ParticipantAdapter(


    filterParticipants(participants,

    new FilterCondition() {

    @Override

    public boolean accept(Participant candidate) {

    return candidate.getTeamColour() ==
    TeamColour.RED;

    }

    })));

    View Slide

  19. Example with params
    participantRedList.setAdapter(

    new ParticipantAdapter(


    filterParticipants(participants,

    new FilterCondition() {

    @Override

    public boolean accept(Participant candidate) {

    return candidate.getTeamColour() ==
    TeamColour.RED;

    }

    })));

    View Slide

  20. Example with params
    participantRedList.setAdapter(

    new ParticipantAdapter(


    filterParticipants(participants,

    new FilterCondition() {

    @Override

    public boolean accept(Participant candidate) {

    return candidate.getTeamColour() ==
    TeamColour.RED;

    }

    })));

    View Slide

  21. Example with params
    participantRedList.setAdapter(

    new ParticipantAdapter(

    filterParticipants(participants,

    (candidate) -> candidate.getTeamColour() ==
    TeamColour.RED)));

    View Slide

  22. Example with params
    participantRedList.setAdapter(

    new ParticipantAdapter(

    filterParticipants(participants,

    (candidate) -> candidate.getTeamColour() ==
    TeamColour.RED)));

    View Slide

  23. Syntax
    p -> p.getAge() >= 18
    (a,b) -> a.getAge() < b.getAge()
    () -> Timber.d(“Ping”)
    (p) -> {

    Timber.d(“Participant age : %d”, p.getAge());

    return p.getAge() < 18;

    }

    View Slide

  24. Syntax
    p -> p.getAge() >= 18
    (a,b) -> a.getAge() < b.getAge()
    () -> Timber.d(“Ping”)
    (p) -> {

    Timber.d(“Participant age : %d”, p.getAge());

    return p.getAge() < 18;

    }

    View Slide

  25. Syntax
    p -> p.getAge() >= 18
    (a,b) -> a.getAge() < b.getAge()
    () -> Timber.d(“Ping”)
    (p) -> {

    Timber.d(“Participant age : %d”, p.getAge());

    return p.getAge() < 18;

    }

    View Slide

  26. Syntax
    p -> p.getAge() >= 18
    (a,b) -> a.getAge() < b.getAge()
    () -> Timber.d(“Ping”)
    (p) -> {

    Timber.d(“Participant age : %d”, p.getAge());

    return p.getAge() < 18;

    }

    View Slide

  27. Lambdas
    & Method references

    View Slide

  28. Method references
    Compact lambda expressions for methods that already
    have a name

    View Slide

  29. Example

    Collections.sort(participants,
    new Comparator() {

    @Override

    public int compare(Participant p1, Participant p2) {

    return Integer.compare(p1.getAge(), 

    p2.getAge());

    }

    });

    View Slide

  30. Example

    Collections.sort(participants,
    (p1, p2) -> Integer.compare(p1.getAge(), 

    p2.getAge()));

    View Slide

  31. Example
    public final class Participant {

    ….

    public static int compareByAge(Participant a, 

    Participant b) {

    return Integer.compare(a.getAge(), b.getAge());

    }

    ….

    }

    View Slide

  32. Example
    public final class Participant {

    ….

    public static int compareByAge(Participant a, 

    Participant b) {

    return Integer.compare(a.getAge(), b.getAge());

    }

    ….

    }

    View Slide

  33. Example

    Collections.sort(participants,
    new Comparator() {

    @Override

    public int compare(Participant p1, Participant p2) {

    return Participant.compareByAge(p1,p2);

    }

    });

    View Slide

  34. Example

    Collections.sort(participants,
    (p1, p2) -> Participant.compareByAge(p1, p2));

    View Slide

  35. Example

    Collections.sort(participants,

    Participant::compareByAge);

    View Slide

  36. From

    Collections.sort(participants,
    new Comparator() {

    @Override

    public int compare(Participant p1, Participant p2) {

    return Participant.compareByAge(p1,p2);

    }

    });

    View Slide

  37. To

    Collections.sort(participants,

    Participant::compareByAge);

    View Slide

  38. Android N

    Collections.sort(participants,

    Comparator.comparingInt(Participant::getAge));

    View Slide

  39. Syntax

    View Slide

  40. Syntax
    • Reference to a static method
    (s) -> String.valueOf(s)

    View Slide

  41. Syntax
    • Reference to a static method
    (s) -> String.valueOf(s)
    String::valueOf

    View Slide

  42. Syntax
    • Reference to an instance method of a particular
    object
    (o) -> o.toString()

    View Slide

  43. Syntax
    • Reference to an instance method of a particular
    object
    (o) -> o.toString()
    o::toString

    View Slide

  44. Syntax
    • Reference to an instance method of an arbitrary
    object of a particular type
    Arrays.sort((a,b) -> a.compareToIgnoreCase(b))

    View Slide

  45. Syntax
    • Reference to an instance method of an arbitrary
    object of a particular type
    Arrays.sort((a,b) -> a.compareToIgnoreCase(b))
    Arrays.sort(String::compareToIgnoreCase)

    View Slide

  46. Syntax
    • Reference to an instance method of an arbitrary
    object of a particular type
    Arrays.sort((a,b) -> a.compareToIgnoreCase(b))
    Arrays.sort(String::compareToIgnoreCase)

    View Slide

  47. Syntax
    • Reference to a constructor
    () -> new String()

    View Slide

  48. Syntax
    • Reference to a constructor
    () -> new String()
    String::new

    View Slide

  49. Method count

    View Slide

  50. Method count
    • Exploring Java’s Hidden Costs (Jake Wharton)
    • 23:30 — Lambdas

    View Slide

  51. Method count
    From: https://speakerdeck.com/jakewharton/exploring-hidden-java-costs-360-andev-july-2016?slide=126

    View Slide

  52. Comparison with Kotlin
    • Claims no increase in method count, bytecode
    inserted directly (see post)

    View Slide

  53. Backward-compatible
    features
    • Lambdas
    • Method references
    • Type annotations

    View Slide

  54. Type annotations
    Annotations can now be used anywhere you use a type

    View Slide

  55. Annotations before Java 8
    • Method: @Override void onCreate()…
    • Class: 

    @RunWith(JUnit4Runner.class) 

    public class TestDoggieTreats {…
    • Parameters, return values

    @NonNull String prepareText(@Nullable input);

    View Slide

  56. Type annotations
    • Anywhere you use a type
    • Class instantiation: new @Interned MyObject();
    • Type cast: myString = (@NonNull String) str;
    • Implements clause: class UnmodifiableList
    implements @Readonly List<@Readonly T> { ... }
    • Throws: void monitorTemperature() throws @Critical
    TemperatureException { ... }

    View Slide

  57. Type annotations
    • Anywhere you use a type
    • Class instantiation: new @Interned MyObject();
    • Type cast: myString = (@NonNull String) str;
    • Implements clause: class UnmodifiableList
    implements @Readonly List<@Readonly T> { ... }
    • Throws: void monitorTemperature() throws @Critical
    TemperatureException { ... }

    View Slide

  58. Requirements
    • Using the Jack compiler
    • Setting language compatibility to 1.8
    • (more on that later)

    View Slide

  59. Nougat only

    View Slide

  60. Nougat only features
    • Streams
    • Default and static interface methods
    • Repeatable annotations

    View Slide

  61. Streams
    A new abstraction that lets you process data in a
    declarative way

    View Slide

  62. Streams
    Data manipulation like you always dreamed of.
    Can filter, map & reduce while being traversed, sequentially or in parallel.

    View Slide

  63. Example
    public interface FilterCondition {

    boolean accept(T candidate);

    }

    List filter(List 

    participants, 

    FilterCondition 

    filterCondition)

    View Slide

  64. Example
    List output = new ArrayList<>();


    for (Participant participant : participants) {

    if (filterCondition.accept(participant)) {

    output.add(participant);

    }

    }


    return output;


    View Slide

  65. Example
    return participants.stream()

    .filter(filterCondition::accept)

    .collect(Collectors.toList());

    View Slide

  66. Example
    return participants.stream()

    .filter(filterCondition::accept)

    .collect(Collectors.toList());

    View Slide

  67. Example
    return participants.stream()

    .filter((participant) -> 

    filterCondition.accept(participant))

    .collect(Collectors.toList());

    View Slide

  68. Example
    return participants.stream()

    .filter(filterCondition::accept)

    .collect(Collectors.toList());

    View Slide

  69. Example
    return participants.stream()

    .filter(filterCondition::accept)

    .collect(Collectors.toList());

    View Slide

  70. Example
    List filter(

    List participants,
    Predicate predicate)


    return participants.stream()

    .filter(predicate)

    .collect(Collectors.toList());

    View Slide

  71. Example
    List filter(

    List participants,
    Predicate predicate)


    return participants.stream()

    .filter(predicate)

    .collect(Collectors.toList());

    View Slide

  72. Find the youngest
    participants

    .stream()

    .min(Comparator.comparingInt(

    Participant::getAge))

    .ifPresent(

    participant -> 

    Timber.d("Youngest participant %s", 

    participant.getName()));


    View Slide

  73. Find the youngest
    participants

    .stream()

    .min(Comparator.comparingInt(

    Participant::getAge))

    .ifPresent(

    participant -> 

    Timber.d("Youngest participant %s", 

    participant.getName()));


    View Slide

  74. Find the youngest
    participants

    .stream()

    .min(Comparator.comparingInt(

    Participant::getAge))

    .ifPresent(

    participant -> 

    Timber.d("Youngest participant %s", 

    participant.getName()));


    View Slide

  75. Find the youngest
    participants

    .stream()

    .min(Comparator.comparingInt(

    Participant::getAge))

    .ifPresent(

    participant -> 

    Timber.d("Youngest participant %s", 

    participant.getName()));


    View Slide

  76. Find the youngest
    participants

    .parallelStream()

    .min(Comparator.comparingInt(

    Participant::getAge))

    .ifPresent(

    participant -> 

    Timber.d("Youngest participant %s", 

    participant.getName()));


    View Slide

  77. Map
    Set names =

    participants.stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toSet());

    View Slide

  78. Map
    Set names =

    participants.stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toSet());

    View Slide

  79. Map
    Set names =

    participants.stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toSet());

    View Slide

  80. Map
    SortedSet names =

    participants.stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toCollection(TreeSet::new));

    View Slide

  81. Map
    SortedSet names =

    participants.stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toCollection(TreeSet::new));

    View Slide

  82. Streams are lazy
    • The intermediate operations are always lazy
    • The “terminal” operations produce values or side-
    effects

    View Slide

  83. Map
    SortedSet names =

    participants

    .stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toCollection(TreeSet::new));

    View Slide

  84. Map
    SortedSet names =

    participants

    .stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toCollection(TreeSet::new));

    View Slide

  85. Map
    SortedSet names =

    participants

    .stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toCollection(TreeSet::new));

    View Slide

  86. Map
    SortedSet names =

    participants

    .stream()

    .map(Participant::getName)

    .sorted()

    .collect(Collectors.toCollection(TreeSet::new));

    View Slide

  87. Map
    SortedSet names =

    participants

    .stream()

    .map(Participant::getName)

    .sorted()

    .limit(2)

    .collect(Collectors.toCollection(TreeSet::new));

    View Slide

  88. Nougat only features
    • Streams
    • Default and static interface methods
    • Repeatable annotations

    View Slide

  89. Default methods

    View Slide

  90. Default methods
    How do streams work?

    View Slide

  91. Default methods
    • How to build “streams” without breaking all custom
    collections?
    • Collection interface adds:
    • boolean removeIf(Predicate super E> filter)
    • Spliterator spliterator()
    • Stream stream()
    • Stream parallelStream()

    View Slide

  92. Default methods
    • default boolean removeIf(Predicate super E> filter)
    • default Spliterator spliterator()
    • default Stream stream()
    • default Stream parallelStream()

    View Slide

  93. Default methods
    Enables you to add new (default) implementations to
    interfaces so implementing classes don’t need to change

    View Slide

  94. Collection
    @Override

    default Spliterator spliterator() {

    return Spliterators.spliterator(this, 0);

    }

    default Stream stream() {

    return StreamSupport.stream(spliterator(), false);

    }

    View Slide

  95. Implementing classes
    • When you implement an interface that contains a
    default method, you can do the following:
    • Not mention the default method at all, which lets
    your implementation use the default method
    • Override the default method
    • Reuse the default method implementation using
    super

    View Slide

  96. Implementing classes
    • Not mention the default method at all, which lets
    your implementation use the default method

    View Slide

  97. Implementing classes
    • Not mention the default method at all, which lets
    your implementation use the default method
    class FancyList implements Collection

    View Slide

  98. Implementing classes
    • Override the default method

    View Slide

  99. Implementing classes
    • Override the default method
    class FancyList implements Collection
    @Override

    public Stream stream() {

    return ….. 

    }

    View Slide

  100. Implementing classes
    • Reuse the default method implementation using
    super

    View Slide

  101. Implementing classes
    • Reuse the default method implementation using super
    class FancyList implements Collection
    @Override

    Stream stream() {

    // ……

    return super.stream();

    }

    View Slide

  102. Extending interface
    • When you extend an interface that contains a
    default method, you can do the following:
    • Not mention the default method at all, which lets
    your extended interface inherit the default
    method
    • Redeclare the default method, which makes it
    abstract
    • Redefine the default method, which overrides it

    View Slide

  103. Extending interface
    • Not mention the default method at all, which lets
    your extended interface inherit the default method

    View Slide

  104. Extending interface
    • Not mention the default method at all, which lets
    your extended interface inherit the default method
    interface Set extends Collection {

    ….

    }

    View Slide

  105. Extending interface
    • Redeclare the default method, which makes it
    abstract

    View Slide

  106. Extending interface
    • Redeclare the default method, which makes it
    abstract


    interface FancySet extends Collection {

    ….

    Stream stream();

    }

    View Slide

  107. Extending interface
    • Redefine the default method, which overrides it

    View Slide

  108. Extending interface
    • Redefine the default method, which overrides it
    interface Set extends Collection {

    ….

    @Override default Spliterator spliterator() {

    return Spliterators.spliterator(this,
    Spliterator.DISTINCT);

    }

    }

    View Slide

  109. Multiple inheritance?
    public interface A {

    default void foo() {

    Timber.d(“Calling A.foo()");

    }

    }







    public class ProblematicClass
    implements A, B {

    //…..

    }
    public interface B {

    default void foo() {

    Timber.d(“Calling B.foo()");

    }

    }

    View Slide

  110. Multiple inheritance?
    public interface A {

    default void foo() {

    Timber.d(“Calling A.foo()");

    }

    }







    public class ProblematicClass
    implements A, B {

    //…..

    }
    public interface B {

    default void foo() {

    Timber.d(“Calling B.foo()");

    }

    }

    View Slide

  111. Multiple inheritance
    public class ProblematicClass implements A, B {
    }
    // error: class ProblematicClass inherits unrelated
    defaults for foo() from types A and B

    View Slide

  112. Multiple inheritance
    public class ProblematicClass implements A, B {
    }
    // error: class ProblematicClass inherits unrelated
    defaults for foo() from types A and B

    View Slide

  113. Multiple inheritance
    public class ProblematicClass implements A, B {
    @Override public void foo() {
    }
    }

    View Slide

  114. Multiple inheritance
    public class ProblematicClass implements A, B {
    @Override public void foo() {
    A.super.foo();
    B.super.foo();
    }
    }

    View Slide

  115. Instances methods vs
    default methods
    public class Horse {
    public String identifyMyself() {
    return "I am a horse.";
    }
    }
    public interface Flyer {
    default public String identifyMyself() {
    return "I am able to fly.";
    }
    }
    public interface Mythical {
    default public String identifyMyself() {
    return "I am a mythical creature.";
    }
    }
    public class Pegasus extends Horse implements
    Flyer, Mythical {
    public static void main(String... args) {
    Pegasus myApp = new Pegasus();
    System.out.println(myApp.identifyMyself());
    }
    }

    View Slide

  116. Instances methods vs
    default methods
    public class Horse {
    public String identifyMyself() {
    return "I am a horse.";
    }
    }
    public interface Flyer {
    default public String identifyMyself() {
    return "I am able to fly.";
    }
    }
    public interface Mythical {
    default public String identifyMyself() {
    return "I am a mythical creature.";
    }
    }
    public class Pegasus extends Horse implements
    Flyer, Mythical {
    public static void main(String... args) {
    Pegasus myApp = new Pegasus();
    System.out.println(myApp.identifyMyself());
    }
    }

    View Slide

  117. Instances methods vs
    default methods
    public class Horse {
    public String identifyMyself() {
    return "I am a horse.";
    }
    }
    public interface Flyer {
    default public String identifyMyself() {
    return "I am able to fly.";
    }
    }
    public interface Mythical {
    default public String identifyMyself() {
    return "I am a mythical creature.";
    }
    }
    public class Pegasus extends Horse implements
    Flyer, Mythical {
    public static void main(String... args) {
    Pegasus myApp = new Pegasus();
    System.out.println(myApp.identifyMyself());
    }
    }

    View Slide

  118. Instances methods vs
    default methods
    public class Horse {
    public String identifyMyself() {
    return "I am a horse.";
    }
    }
    public interface Flyer {
    default public String identifyMyself() {
    return "I am able to fly.";
    }
    }
    public interface Mythical {
    default public String identifyMyself() {
    return "I am a mythical creature.";
    }
    }
    public class Pegasus extends Horse implements
    Flyer, Mythical {
    public static void main(String... args) {
    Pegasus myApp = new Pegasus();
    System.out.println(myApp.identifyMyself());
    }
    }

    View Slide

  119. Instances methods vs
    default methods
    public class Horse {
    public String identifyMyself() {
    return "I am a horse.";
    }
    }
    public interface Flyer {
    default public String identifyMyself() {
    return "I am able to fly.";
    }
    }
    public interface Mythical {
    default public String identifyMyself() {
    return "I am a mythical creature.";
    }
    }
    public class Pegasus extends Horse implements
    Flyer, Mythical {
    public static void main(String... args) {
    Pegasus myApp = new Pegasus();
    System.out.println(myApp.identifyMyself());
    }
    }

    View Slide

  120. Instances methods vs
    default methods
    • Instance methods are preferred over interface
    default methods
    • The method Pegasus.identifyMyself returns the
    string I am a horse.

    View Slide

  121. Static methods
    • Comparator gains:


    public static >
    Comparator reverseOrder() {

    return Collections.reverseOrder();

    }

    View Slide

  122. Nougat only features
    • Streams
    • Default and static interface methods
    • Repeatable annotations

    View Slide

  123. Repeatable
    annotations
    You may now create annotations that can be repeated

    View Slide

  124. Example
    @Schedule(dayOfMonth="last")

    @Schedule(dayOfWeek="Fri", hour="23")

    public void doPeriodicCleanup() { ... }

    View Slide

  125. How-to
    • Declare the annotation as repeatable
    • Declare a containing annotation type
    • See: https://docs.oracle.com/javase/tutorial/java/
    annotations/repeating.html

    View Slide

  126. Pre-N alternatives

    View Slide

  127. Alternative options
    • Lambdas -> Retrolambda
    • Streams -> Lightweight Stream API

    View Slide

  128. Build setup

    View Slide

  129. Requirements
    • This applies for all Java 8 features
    • Requirements:
    • Use Jack & Jill
    • Set language compatibility
    • Android Studio 2.1+
    • Build tools 21.1.1+

    View Slide

  130. A bit about Jack
    • Jack is a new Android toolchain
    • Compiles Java source into Android dex bytecode
    • Replaces the previous toolchain
    • javac, ProGuard, jarjar, dx etc.

    View Slide

  131. A bit about Jack

    View Slide

  132. What’s Jill?
    • Jill translates the existing .jar libraries into the new
    library format

    View Slide

  133. A bit about Jill

    View Slide

  134. How to setup
    • Instructions at : https://developer.android.com/
    guide/platform/j8-jack.html

    View Slide

  135. Annotation processor
    • If you’re using Dagger, Butterknife etc.
    apply plugin: 'com.neenbedankt.android-apt'

    apt 'com.google.dagger:dagger-compiler:2.2'

    View Slide

  136. Annotation processor
    annotationProcessor
    ‘com.google.dagger:dagger-compiler:2.2’

    View Slide

  137. Annotation processor
    • Guide: https://bitbucket.org/hvisser/android-apt/
    wiki/Migration

    View Slide

  138. Known issues
    • Jack does not generate intermediate class files
    when compiling an app, so it breaks some tools
    • Instant run doesn’t work with Jack
    • Lint that operates on class files
    • JaCoCo instrumentation (now fixed)
    • Possible Kotlin issues

    View Slide

  139. Known issues
    • Updated list: https://source.android.com/source/
    known-issues.html
    • The one under Java 8 features doesn’t seem to be
    updated
    • File bugs: http://tools.android.com/filing-bugs

    View Slide

  140. Resources

    View Slide

  141. Links — Lambdas
    • Many lambda examples: docs.oracle.com/javase/
    tutorial/java/javaOO/lambdaexpressions.html
    • Lambda tutorial: https://github.com/
    AdoptOpenJDK/lambda-tutorial
    • Official docs on Streams: http://docs.oracle.com/
    javase/tutorial/collections/streams/
    • Streams tutorial: http://blog.hartveld.com/2013/03/
    jdk-8-33-stream-api.html

    View Slide

  142. Other talks
    • Exploring Java’s Hidden Costs (@JakeWharton)
    • Jack and Jill build system (Eric Lafortune)
    • API Design With Java 8 Lambda and Streams
    (@stuartmarks & @BrianGoetz)

    View Slide

  143. Thank you
    http://bit.do/droidcon-java8

    https://github.com/anothem/
    java8-android

    View Slide