Java merge list method code example


This article mainly introduces the Java merge list method code example, the article through the example code introduction is very detailed, to everybody’s study or the work has certain reference study value, needs the friend may refer to

List includes the list interface and all implementation classes of the list interface. Because the list interface implements the collection interface, the list interface has all the common methods provided by the collection interface. Because list is a list type, the list interface also provides some common methods suitable for itself

Method 1

  List<Children> reduce =
      .map(x -> x.getChildren())
      .reduce(new ArrayList<>(), (all, item) -> {
        return all;

Method 2

List<Children> collect =
List<Children> childrens1 = new ArrayList<>();
for (long i =0;i<10;i++){
  childrens1.add(new Children(i,"x".concat(i+"")));
List<Children> childrens2 = new ArrayList<>();
for (long i =100;i<110;i++){
  childrens2.add(new Children(i,"x".concat(i+"")));
Employee Mazi = new employee ("pockmarks", 90, 989.2);
Employee Lisi = new employee ("Li Si", 10, 1000.1);
List<Employee> list = Arrays.asList(mazi,lisi);

The above is the whole content of this article, I hope to help you in your study, and I hope you can support developeppaer more.

Recommended Today

Api: tiktok: user video list

Tiktok tiktok, tiktok, tiktok, Api, Api, jitter, voice, bullet screen comments, jitter, jitter, and jitter. Tiktok tiktok tiktok data, jitter data acquisition, live broadcast of shaking sound Titodata: professional short video data acquisition and processing platform. For more information, please contact:TiToData Massive data collection Collect 500 million pieces of data for customers every day Tiktok […]