美文网首页
构造 HashMap<>、List (二)

构造 HashMap<>、List (二)

作者: L柠_檬 | 来源:发表于2017-09-19 15:12 被阅读62次

    HashMap:相当于 iOS 里面的 NSMutableDictionary
    List :相当于 iOS 里面的 NSMutableArray

    List data = new ArrayList<>();
    
    Map one = new HashMap<>()    
    one.put("color", "#ff8804");
    one.put("title", "真功夫");
    one.put("jumpTo", "https://www.baidu.com");
    one.put("imgUrl", "https://www.baidu.com.png");
    one.put("nativeId", "0");
    data.add(one);
    
    one = new HashMap<>();
    one.put("color", "#ff8804");
    one.put("title", "2017重大人事动态");
    one.put("jumpTo", "https://www.baidu.com");
    one.put("imgUrl", "https://www.baidu.com.png");
    one.put("nativeId", "0");
    data.add(one);
    
    return  new ResponseEntity(new BannerModel(0,"success",data), HttpStatus.OK );
    

    相关文章

      网友评论

          本文标题:构造 HashMap<>、List (二)

          本文链接:https://www.haomeiwen.com/subject/xgrlsxtx.html