S
S
Shurik2015-02-24 01:16:25
Java
Shurik, 2015-02-24 01:16:25

What is a construct in Java?

I started learning Java, and here is this:

import static spark.Spark.*;

public class HelloWorld {
    public static void main(String[] args) {
        get("/hello", (req, res) -> "Hello World");
    }
}

What is this construction with -> and can anyone explain the essence of this with a clever example?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rikcon, 2015-02-24
@aioon

It seems this is a lambda habrahabr.ru/post/224593

W
Winner_DE, 2015-02-24
@Winner_DE

As I understand it, you are studying this Spark - A tiny Sinatra inspired framework for creating web applications in Java 8 with minimal effort.
If I understand correctly, then the request is "get("/hello", (req, res) -> "Hello World");" and the actual response arrives from the server.

A
asd111, 2015-02-24
@asd111

Lambda
docs.oracle.com/javase/tutorial/java/javaOO/lambda...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question