java design pattern_ Decorator mode

1 Overview The purpose of decorator mode is to enhance the performance of classes. Inheritance can also enhance the functionality of classes. 2 examples (easy to observe and understand the decoration mode) The Writer class is a class that writes files. It has three subclasses: TxtWriter, MP3Writer and AVIWriter The standard for writing fil ...

Added by siric on Sat, 05 Mar 2022 01:16:39 +0200

Real topic of the 11th Java group B Blue Bridge Cup

Write in front Time flies, time flies, in a trance, the start of the Blue Bridge Cup is close at hand.. Why is it so official... Cough, the game will start tomorrow. As the saying goes, whet your gun when you are ready, you will be unhappy! Adhering to the excellent expertise of the Chinese nation, I came to brush the real problem of last year ...

Added by kingman65 on Sat, 05 Mar 2022 00:55:05 +0200

Unified exception handling, assertion and enumeration combined use cases

In the process of software development, it is inevitable to deal with all kinds of exceptions. For myself, at least more than half of the time is dealing with all kinds of exceptions, so there will be a lot of try {...} in the code catch {...} finally {...} Code blocks not only have a large number of redundant code, but also affect the readabi ...

Added by Ammar on Sat, 05 Mar 2022 00:21:16 +0200

[design mode youth version] create | singleton mode

Example creation mode (single type) Hungry Han style Hungry Chinese singleton has created a static object for the system to use at the same time of class creation, which will not be changed in the future. Therefore, it is thread safe and can be directly used for multithreading without problems. The feature of this pattern is that once th ...

Added by jahwobbler on Sat, 05 Mar 2022 00:18:50 +0200

[Java basics] 009 internal classes

concept In Java, a class can be defined in another class or a method. Such a class is called an inner class. In a broad sense, internal classes generally include these four types: member internal classes, local internal classes, anonymous internal classes and static internal classes. Member inner class Member inner class is the most ...

Added by joeysarsenal on Fri, 04 Mar 2022 23:42:35 +0200

Kobular data

A baby suckling dog will have a name, breed and a bunch of lovely characteristics as its attributes. If you model it as a class and only use it to hold these attribute data, you should use the data class. When using data classes, the compiler will automatically generate toString(), equals() and hashCode() functions for you, and provide them o ...

Added by vumpler on Fri, 04 Mar 2022 23:18:21 +0200

Predict interface of Java 8

The test () part of the predict interface is the source code @FunctionalInterface public interface Predicate<T> { /** * The specific filtering operation needs to be implemented by subclasses * Used to process whether the parameter t meets the requirements */ boolean test(T t); The test method is used to: 1 . Ev ...

Added by Beyond Reality on Fri, 04 Mar 2022 22:39:04 +0200

Why not recommend using real numbers as the key of HashMap?

1. CausesThe reason why I pay attention to this is a question, which is described as follows:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.The main idea is to give me the X and Y coordinates of some points, find the line with the most points, and output the number of points on this lineSo I t ...

Added by bobby4 on Fri, 04 Mar 2022 22:37:49 +0200

day036 filter

1 case 1 - automatic login 1.1 requirements and process introduction When the user directly accesses the login page (e.g. shopping cart page, order page, etc.), the user object of the last login is directly displayed. This function is the function of automatic login. If the user did not check auto login when logging in last time, the user wil ...

Added by c4onastick on Fri, 04 Mar 2022 21:59:13 +0200

Java unit testing tool for software quality and testing: JUnit4 learning

preface JUnit is a unit test framework of Java programming language, which is a simple framework for writing reusable test sets. JUnit has a very important development in test driven development. It is one of the unit testing frameworks collectively called xUnit, which originated from JUnit. XUnit is a test framework based on test driven ...

Added by SteveFrost on Fri, 04 Mar 2022 20:39:17 +0200