인프런 영문 브랜드 로고
인프런 영문 브랜드 로고
BEST
Programming

/

Programming Language

More Java, Java 8

The features added to Java 8 are widely used in APIs provided by Java as well as third-party libraries and frameworks such as Spring. If you are a Java developer in this era, you must know them. Make them your own technology easily and quickly through this lecture.

(4.9) 324 reviews

4,369 students

Java
Thumbnail

This course is prepared for Basic Learners.

What you will learn!

  • Learn about functional interfaces, lambdas, and method references.

  • Learn about basic and static methods in interfaces.

  • Learn about Streams and Optionals.

How to properly utilize JAVA 8
I'll show you the smartest way.

🙆🏻‍♀ In this lecture, we will learn the major features added in Java 8.
Understand Java 8 code and write it yourself! 🙆🏻‍♂

Lecture Introduction 👨‍💻

Learn about Java 8, which was first released in March 2014 and is still the most widely used version by Java developers more than six years later.

If you have completed your basic study of Java, but still feel like you don't know much about Java and see unfamiliar syntax when looking at code written by others, it may be because you do not fully understand the features added in Java 8 .

What can you do with Java 8? 🐔🍴

Here we have a prototype chicken that implements an interface called Chicken.

public class KeesunChicken implements Chicken {

}

As you can see, we only implemented the interface and did not override any methods.
But this is possible.

public class App {

public static void main(String[] args) {

Chicken keesun = new KeesunChicken();

Egg egg = keesun.create();

}

}

How on earth can we use the create() method that returns an Egg?

Okay, let's look at the following code. Here's a chicken. It's taking care of an egg that wants to become a half-and-half chicken.

Chicken.takesCare(new Egg() {

@Override

public String wannaBe() {

return "Seasoned Half Fried Half";

}

});

This code can also be shortened to:

Chicken.takesCare(() -> "Seasoned Half Fried Half");

Are you wondering how we can reduce this so cleanly without even using the Egg type?

This time, let's classify eggs.

List eggs = new ArrayList<>();

eggs.add(EggWithColorAndSize.of().size(3).color("yellow"));

eggs.add(EggWithColorAndSize.of().size(4).color("white"));

eggs.add(EggWithColorAndSize.of().size(3).color("white"));

eggs.add(EggWithColorAndSize.of().size(5).color("yellow"));

eggs.add(EggWithColorAndSize.of().size(3).color("brown"));

eggs.add(EggWithColorAndSize.of().size(4).color("yellow"));

Among the eggs shown here, let's select only the yellow eggs, sort them by size, and then print the egg's wannaBe.
After taking this course, you will be able to write and understand code like this:

eggs.stream().filter(e -> e.getColor().equals("yellow"))

.sorted(Comparator.comparingInt(EggWithColorAndSize::getSize))

.map(EggWithColorAndSize::wannaBe)

.forEach(System.out::println);

You can also understand and write code like the following, which runs the egg-laying task in a separate thread and then enjoys the egg when it's laid (with a callback):

CompletableFuture future = CompletableFuture.supplyAsync(() -> {

System.out.println("Kkoki-o~ Kkokko-kko~ " + Thread.currentThread().getName());

return EggWithColorAndSize.of().size(5).color("white");

}).thenAccept((egg) -> {

System.out.println("Yum yum yum: " + egg.wannaBe());

});


future.get();

There are many other interesting contents such as Date and Time API provided by Java 8, changes in annotations, and changes in memory areas, so please take the class a lot.

thank you

Recommended for
these people!

Who is this course right for?

  • Developers or students who have completed basic Java programming training

  • Developers or students who want to learn the key features of Java 8

Need to know before starting?

  • Java Programming Fundamentals

Hello
This is

91,116

Students

4,044

Reviews

2,009

Answers

4.8

Rating

20

Courses

네이버와 아마존을 거쳐 현재 Microsoft에서 시니어 소프트웨어 엔지니어로 일하고 있습니다.

아인슈타인은 "교육이란 사실을 가르치는 것이 아니라, 생각할 수 있는 힘을 기르는 것이다."라고 말했습니다. 그리고 저도 그 말에 깊이 공감하며 강의를 만들고 있습니다.

유튜브:
'백기선' 채널에서 개발자 고민 상담 및 개발자에게 유용한 지식 공유
번역: 스프링 및 하이버네이트 관련 서적 다수 번역
저술: 쉽게 따라하는 자바 웹 개발

Curriculum

All

23 lectures ∙ (4hr 56min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

Not enough reviews.
Become the author of a review that helps everyone!