S
S
SankaSanka2020-01-22 21:32:51
Java
SankaSanka, 2020-01-22 21:32:51

How to expand lambda into normal code?

please tell me how to translate this into the tranee language from the middle.
the output should be a regular string without interfaces with lambdas
, you need to expand and simplify this thing for understanding.
thanks in advance

public static void main (String[] args) 
    {
        String s = "Два кусо-чека колбаски In Your table someone to eats very speed и ничего не оставил";
        Pattern pat = Pattern.compile("\\b(?:(\\p{Lu})|\\p{Ll})(?=\\p{L}{2})");
        Matcher match = pat.matcher(s);
        System.out.println( match.replaceAll(u -> 
            u.group(1) == null ? u.group().toUpperCase() : u.group().toLowerCase()) 
        );
    }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Roo, 2020-01-23
@SankaSanka

System.out.println( match.replaceAll(new Function<MatchResult, String>() {
                                                 @Override
                                                 public String apply(MatchResult u) {
                                                     return u.group(1) == null ? u.group().toUpperCase() : u.group().toLowerCase();
                                                 }
                }));

Стало понятнее? )

Роман, 2020-01-22
@Terran37

I would advise you to try to figure it out yourself. Here is an article that will give you knowledge.
https://m.habr.com/ru/company/luxoft/blog/270383/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question