java 数组匹配_Java8List对象中的List匹配元素 返回当前匹配后的数据(含外数组)

  • Post author:
  • Post category:java


需求:获取lols中的player某个元素

import com.alibaba.fastjson.JSONObject;

import lombok.*;

import org.springframework.util.CollectionUtils;

import java.util.ArrayList;

import java.util.Arrays;

import java.util.List;

import java.util.stream.Collectors;

public class Demo {

@Builder

@Data

@AllArgsConstructor

@NoArgsConstructor

@ToString

static class LOL{

//赛区

private String area;

//战队名称

private String teamName;

//战队选手

List player;

}

private static List lols= new ArrayList<>();;

static {

lols.add( new LOL( “LPL”, “IG”, Arrays.asList( “TheShy”,”JK”,”Rk”,”BaoLan”,”Ning”) ));

lols.add( new LOL( “LPL”, “FPX”, Arrays.asList( &#



版权声明:本文为weixin_39557576原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。