Deep understanding of lambda expression and functional programming functional interface source code analysis

package com.java.design.java8; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.Arrays; import java.util.Compar ...

Added by Cagecrawler on Sun, 01 Dec 2019 22:03:58 +0200

Java steam API exercise (flow creation, flow operation, flow termination)

Exercises 1 Given a list of numbers, how can I return a list of the squares of each number? , given [1, 2, 3, 4, 5], it should return [1, 4, 9, 16, 25] public class Problem1 { public static void main(String[] args) { // TODO Auto-generated method stub List<Integer> list1 = Arrays.asList(1,2,3,4,5); List<Intege ...

Added by kincet7 on Sun, 01 Dec 2019 16:29:10 +0200

Strategy mode and factory mode

The combination of policy pattern and factory pattern can eliminate the multi nesting of code if else demand There is such a demand for under store stores. There are four levels for user customers: ordinary customers, vip customers, super vip users and exclusive vip users. When users purchase goods, different discount strategies are adopted f ...

Added by supermars on Mon, 04 Nov 2019 03:51:54 +0200

[Java required course] performance comparison of contains method between ArrayList and HashSet (JMH performance test)

1 Introduction In daily development, ArrayList and HashSet are very common collection classes in Java. ArrayList is the most commonly used implementation class of List interface. HashSet is the implementation that holds the unique element Set. This paper mainly makes a simple discussion on the common method contains(), mainly the performanc ...

Added by CodeEye on Wed, 23 Oct 2019 17:03:08 +0300

Java indoor shortest path search (multi floor support)

We have modified the last code. Now we support the shortest path search in the case of indoor multi floors. We still use the A * algorithm to use the data field that VNode does not use in GraphAdjList as the location where we store the floor properties. In fact, I'm lazy. Under normal circumstances, an int level attribute should be added to VN ...

Added by Danaldinho on Sat, 19 Oct 2019 12:41:47 +0300

spring-aop notification example

Application of Spring AOP Notification xml version Create a new maven project Project Structure Diagram pom.xml file <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLo ...

Added by ngolehung84 on Fri, 11 Oct 2019 22:45:17 +0300

Introduction to Socket Communication

I. Socket sockets Two programs on the network communicate through a two-way connection to realize data exchange. One end of the connection is called a socket. Using socket to develop TCP program in java, this method can easily establish reliable, bidirectional, persistent, point-to-point communication connection. In the development of socket ...

Added by FSGr33n on Mon, 07 Oct 2019 13:45:09 +0300

Java Double Loop Printing Patterns

Links to the original text: https://blog.csdn.net/yajing8/article/details/73548896 Using Java double loop to print various pattern summaries: the outer loop controls the number of rows, which is fixed, and the inner loop controls the output ...

Added by doofystyle on Fri, 04 Oct 2019 18:37:15 +0300

Inheritance, Polymorphism, Static Methods and Variables Testing

  Previously, the polymorphism has always been very vague, today is free, I have a special test. Bean classes to operate on //Non-static variables class A{ int a = 1; } class B extends A{ int a = 3; int b = 2; } //Static variables class AA{ static int a = 1; } class BB extends AA{ static ...

Added by Bismark12 on Thu, 03 Oct 2019 06:09:01 +0300

Memcached Notes: XMemcached&Spring Integration

Links to the original text: https://my.oschina.net/mohaiyong/blog/221285 Memcached Java Client, using XMemcached 1.3.5, does a simple test and describes how to integrate with Spring. ...

Added by ssmitra on Mon, 09 Sep 2019 08:31:52 +0300