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

com.alibaba.middleware.ushura.Pairs Maven / Gradle / Ivy

package com.alibaba.middleware.ushura;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author Hanson on 15/12/25.
 */
public class Pairs {

    /**
     * String类型的权重数据生成工具,从一个Map转换成Chooser识别的数据结构
     * @param itemsWithWeight
     * @return
     */
    public static List> formMap(Map itemsWithWeight){
        List> pairs = new ArrayList>();
        for(Map.Entry entry : itemsWithWeight.entrySet()){
            pairs.add(new Pair(entry.getKey(),entry.getValue())) ;
        }
        return pairs;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy