All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.neko233.toolchain.game.evolution.EvolutionChainUtil Maven / Gradle / Ivy

package com.neko233.toolchain.game.evolution;

import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * 进化工具
 *
 * @author SolarisNeko
 * Date on 2022-12-10
 */
@Slf4j
public class EvolutionChainUtil {

    /**
     * 进化单向链路 Map
     *
     * @param dataList d
     * @param       any
     * @return Map
     */
    public  Map generateSingleEvolutionChainMap(List> dataList) {
        return Optional.ofNullable(dataList).orElse(new ArrayList<>())
                .stream()
                .collect(Collectors.toMap(
                        EvolutionApi::evolutionId,
                        EvolutionApi::nextEvolutionId,
                        (v1, v2) -> v2
                ));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy